# myst-parser

> Markdown parser for MyST markdown in JavaScript

Latest version **1.7.5** (published 2026-10-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install myst-parser
pnpm add myst-parser
yarn add myst-parser
bun add myst-parser
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.7.5 |
| Published | 2026-10-26 |
| First published | 2022-10-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 20 |
| Unpacked size | 514 KB |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 533 |
| Author | Rowan Cockett |
| Maintainers | rowanc1, stevejpurves, ebp-bot |
| Keywords | markdown-it-plugin, markdown-it, markdown, myst, jupyter, jupyter-book |

## Links

- npm: https://www.npmjs.com/package/myst-parser
- Repository: https://github.com/jupyter-book/mystmd
- Homepage: https://github.com/jupyter-book/mystmd/tree/main/packages/myst-parser
- Issues: https://github.com/jupyter-book/mystmd/issues
- npm.io page: https://npm.io/package/myst-parser

## Dependencies (20)

- [he](https://npm.io/package/he.md) ^1.2.0
- [vfile](https://npm.io/package/vfile.md) ^5.3.7
- [unified](https://npm.io/package/unified.md) ^10.1.1
- [myst-spec](https://npm.io/package/myst-spec.md) ^0.0.6
- [myst-roles](https://npm.io/package/myst-roles.md) ^1.7.5
- [markdown-it](https://npm.io/package/markdown-it.md) ^13.0.0
- [myst-common](https://npm.io/package/myst-common.md) ^1.10.2
- [unist-builder](https://npm.io/package/unist-builder.md) ^3.0.0
- [myst-directives](https://npm.io/package/myst-directives.md) ^1.7.5
- [markdown-it-myst](https://npm.io/package/markdown-it-myst.md) 1.0.19
- [unist-util-visit](https://npm.io/package/unist-util-visit.md) ^4.1.0
- [unist-util-remove](https://npm.io/package/unist-util-remove.md) ^3.1.0
- [unist-util-select](https://npm.io/package/unist-util-select.md) ^4.0.3
- [@types/markdown-it](https://npm.io/package/@types/markdown-it.md) ^13.0.0
- [markdown-it-amsmath](https://npm.io/package/markdown-it-amsmath.md) ^0.4.0
- [markdown-it-deflist](https://npm.io/package/markdown-it-deflist.md) ^2.1.0
- [markdown-it-footnote](https://npm.io/package/markdown-it-footnote.md) ^4.0.0
- [markdown-it-dollarmath](https://npm.io/package/markdown-it-dollarmath.md) ^0.5.0
- [markdown-it-task-lists](https://npm.io/package/markdown-it-task-lists.md) ^2.1.1
- [markdown-it-front-matter](https://npm.io/package/markdown-it-front-matter.md) ^0.2.3

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 1.7.5 (latest) — 2026-10-26
- 1.7.4 — 2026-09-21
- 1.7.3 — 2026-06-04
- 1.7.2 — 2026-05-01
- 1.7.1 — 2026-04-01
- 1.7.0 — 2026-03-03
- 1.6.5 — 2026-02-13
- 1.6.4 — 2026-01-21
- 1.6.3 — 2025-12-04
- 1.6.2 — 2025-12-01
- 1.6.1 — 2025-11-18
- 1.6.0 — 2025-11-03
- 1.5.17 — 2025-10-10
- 1.5.16 — 2025-09-08
- 1.5.15 — 2025-07-05
- … 70 more at https://npm.io/package/myst-parser/versions

## README

# myst-parser

MyST (Markedly Structured Text) is designed to create publication-quality documents written entirely in Markdown. The main use case driving the development and design of MyST is [JupyterBook](https://jupyterbook.org/), which helps you create educational online textbooks and tutorials with Jupyter Notebooks and narrative content written in MyST. `myst-parser` is a javascript parser for MyST markdown that brings these capabilities into a web-native environment.

## Goals

- Provide a Javascript implementation of MyST markdown
- Parse MyST into a standardized AST, based on [mdast](https://github.com/syntax-tree/mdast).
- Serialize `mdast` into a default HTML for all known roles and directives
- Expose an opinionated set of `markdown-it` plugins, to be used in ecosystems that require `markdown-it` (e.g. vscode)
- Expose extension points in MyST for new roles/directives
- Provide functionality for cross-referencing that is usually completed by Sphinx (e.g. in the [Python implementation](https://github.com/executablebooks/MyST-Parser))

## Usage

```bash
npm install myst-parser
```

In a node environment:

```javascript
import { mystParser } from 'myst-parser';
import { State, transform, mystToHast, formatHtml } from 'myst-to-html';
import rehypeStringify from 'rehype-stringify';
import { unified } from 'unified';

const pipe = unified()
  .use(mystParser)
  .use(transform, new State())
  .use(mystToHast)
  .use(formatHtml)
  .use(rehypeStringify);

const file = pipe.processSync(':::{important}\nHello to the world!\n:::');
console.log(file.value);
>> <aside class="admonition important"><p class="admonition-title">Important</p><p>Hello to the world!</p></aside>
```

In a browser:

```html
<html>
  <head>
    <script src="https://unpkg.com/myst-parser"></script>
  </head>
  <body onload="init();">
    <div id="output"></div>
    <script>
      function init() {
        const pipe = unified()
          .use(mystParser)
          .use(transform, new State())
          .use(mystToHast)
          .use(formatHtml)
          .use(rehypeStringify);
        const result = pipe.runSync('# Hello to the world!');
        const html = pipe.stringify(result);
        document.getElementById('output').innerHTML = html;
      }
    </script>
  </body>
</html>
```

## `myst-parser` Features

- CommonMark
- Admonitions
- Figures
- Images
- Math
  - role
  - directive (equations)
  - dollar math
  - amsmath
- Tables
  - GFM
  - List Tables
- References
  - ref
  - numref
  - eq
  - links
  - Including numbering (single document)
- Code Directives
  - Code
  - Code blocks
  - Code cell
- Blocks
- Comments
- Targets
- HTML:
  - `sub`
  - `sup`
  - `abbr`
- Definition List
- Footnotes

Not yet complete:

- div
- proof
- margin
- sidebar
- colon fence
- Citations
- Bibliography
- Epigraph
- Glosary
- Terms
- Tabs
- Panels
- CSV Tables
- Multi-document

## Developer Install

For installing the package locally, you will need [node](https://nodejs.org/) and [npm](https://docs.npmjs.com/about-npm), both can use a global install on your system.

Once you have `npm` installed globally, navigate into this project folder and install the dependencies:

```bash
cd myst-parser
npm install
npm run start  # Start a development server to play with the library! 🚀
```

The scripts for building, testing, and serving the project are in the [package.json](package.json), the main ones to use are
`npm run test`, `npm run build`, and `npm run start`.

### `npm run build`

Builds the library, including compiling the typescript and bundling/minification to create `myst.min.js` which can be used in the browser directly.
This outputs to the `dist` folder, and also includes all type definitions (`*.d.ts`) in the types folder.

### `npm run test`

Run the tests, these are mostly based on the [fixtures](fixtures) folder. You can also use `npm run test:watch` to run on any file changes.

### `npm run start`

Starts a server for manually testing and playing with `myst-parser`, this uses a in-memory bundle of what would go in the `dist` folder.
Note that this does not actually build the library!

---
_Source: https://npm.io/package/myst-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
