npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mdgate/ipynb

v0.6.9

Published

mdgate Jupyter notebook converter

Readme

@mdgate/ipynb

Convert Jupyter notebooks to Markdown in TypeScript.

@mdgate/ipynb reads .ipynb files directly in JavaScript and converts cells into GitHub-Flavored Markdown, without Python, native addons, WASM, or Jupyter.

Works in Node.js, Cloudflare Workers, Edge runtimes, and browsers.

npm install @mdgate/ipynb
import { toMarkdown } from '@mdgate/ipynb';

const markdown = await toMarkdown(bytes);

bytes is a Uint8Array, so the notebook can come from a file upload, object storage, a git checkout, a browser file picker, or anywhere else your application gets bytes.


Why @mdgate/ipynb

Notebooks mix prose, code, and outputs. Dumping the raw JSON is a poor input for search, RAG, or an agent.

@mdgate/ipynb is a notebook reader written for the same runtime as your application:

  • Pure TypeScript
  • Notebook → Markdown locally
  • No Python runtime
  • No native addons
  • No WASM runtime
  • Zero third-party runtime dependencies
  • Works with raw Uint8Array input
  • Detects nbformat JSON from its contents, not only the filename

What it extracts

@mdgate/ipynb parses nbformat JSON and rebuilds a shared document model.

The converter handles notebook-specific concerns including:

  • markdown cells as Markdown
  • code cells as fenced code blocks
  • cell outputs that can be represented as text
  • cell order

The output is Markdown that can be searched, indexed, chunked, cached, or passed directly to an AI agent.


Node.js

import { readFile } from 'node:fs/promises';
import { toMarkdown } from '@mdgate/ipynb';

const bytes = new Uint8Array(await readFile('analysis.ipynb'));
const markdown = await toMarkdown(bytes);

console.log(markdown);

Browser

import { toMarkdown } from '@mdgate/ipynb';

const file = input.files![0];
const bytes = new Uint8Array(await file.arrayBuffer());

const markdown = await toMarkdown(bytes);

Cloudflare Workers and Edge runtimes

import { toMarkdown } from '@mdgate/ipynb';

export default {
  async fetch(request: Request) {
    const bytes = new Uint8Array(await request.arrayBuffer());
    const markdown = await toMarkdown(bytes);

    return new Response(markdown, {
      headers: {
        'content-type': 'text/markdown; charset=utf-8',
      },
    });
  },
};

Format detection

You do not need to trust the file extension.

@mdgate/ipynb recognizes Jupyter notebooks from nbformat JSON.

const markdown = await toMarkdown(bytes);

A path can still be supplied as a format hint when @mdgate/ipynb is used through @mdgate/converters or a reader composed with @mdgate/core, but the path is never used to read a file from disk.


Compose it with other file readers

@mdgate/ipynb implements the converter interface from @mdgate/core.

import { create } from '@mdgate/core';
import { ipynb } from '@mdgate/ipynb';
import { html } from '@mdgate/html';

const read = create([
  ipynb(),
  html(),
]);

The application still uses one reading interface while each format remains independently installable.


Need more than notebooks?

If your application needs to read many different file types, use the complete converter set:

npm install @mdgate/converters
import { toMarkdown } from '@mdgate/converters';

const markdown = await toMarkdown(bytes, {
  path: filename,
});

@mdgate/ipynb is one of the single-format packages in the open-source mdgate/converters project.

For AI agents, the same converter architecture can be used to extend read_file from text files to real-world document formats.


License

MIT