micromark parses Markdown into concrete tokens and can compile to HTML. It targets full CommonMark compliance with optional GFM, MDX, math, and frontmatter extensions.
Overview
micromark is a JavaScript Markdown parser implemented as a state machine that emits positional concrete tokens before compiling to HTML. Other tools in the unified ecosystem can consume those tokens to build abstract syntax trees instead of HTML.
The core emphasizes safety by default, strict conformance tested against reference parsers, and optional syntax extensions such as GitHub Flavored Markdown, directives, math, and MDX. Authors can add custom syntax or HTML compile extensions when default remark or rehype plugins are not enough.
The package ships as ESM for Node.js, Deno, and browsers. Typical use buffers input through a simple API, while a streaming interface exists for incremental parsing. Extension packages are published separately for GFM tables, footnotes, task lists, and related features.
Key features
- CommonMark-compliant tokenization
- Optional GFM and MDX extension packs
- Direct HTML compilation from tokens
- Streaming parse API
- Concrete tokens with byte positions
- Pluggable syntax and HTML extensions
- Safe parsing defaults
- Frontmatter and math extensions available
Use cases
- Turning Markdown into HTML in Node or the browser
- Feeding mdast utilities via from-markdown adapters
- Adding custom Markdown syntax extensions
- Building remark or rehype pipelines
- Parsing GFM tables and task lists