remark is a markdown processor built on unified that works by converting markdown into an abstract syntax tree (AST), running plugins against that tree, and then serializing the result back. Because every transformation happens on structured data rather than raw text, plugins can do sophisticated things — reformat code, generate tables of contents, lint for style issues, or bridge into entirely different ecosystems like HTML — all in a composable, predictable way.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/remarkjs/remark/llms.txt
Use this file to discover all available pages before exploring further.
What is remark?
remark is part of the unified collective, a family of projects that process content as structured data. When you hand markdown to remark, it is parsed into mdast — a specification for representing markdown as a JSON-compatible syntax tree. Plugins then walk and modify that tree before the result is serialized back to markdown or handed off to another ecosystem (such as rehype for HTML output). The markdown heading:The four packages
The remark monorepo ships four packages, each serving a distinct role in the pipeline.remark
A pre-configured
unified processor that bundles both remark-parse and remark-stringify. Use it when both your input and output are markdown — it is the shortest path to a markdown-in / markdown-out pipeline.remark-parse
A unified plugin that adds markdown parsing support. It converts a markdown string into an mdast syntax tree. Use it with
unified directly when your output is something other than markdown (for example, HTML via rehype).remark-stringify
A unified plugin that adds markdown serialization support. It converts an mdast syntax tree back into a markdown string. Use it when you need markdown as the final output and are composing your own
unified pipeline.remark-cli
A command-line interface built on top of
remark. Use it to inspect and format markdown files in your project from a terminal or npm script, without writing any JavaScript.When to use remark vs alternatives
Choosing the right tool depends on how much of the pipeline you need.| Goal | Recommended tool |
|---|---|
| Parse and serialize markdown with plugins | remark |
Parse markdown as input to a custom unified pipeline | remark-parse |
| Serialize mdast back to markdown | remark-stringify |
| Inspect or reformat markdown files on the CLI | remark-cli |
| Simply convert markdown to HTML (no plugins needed) | micromark |
| Access the syntax tree directly without plugins | mdast-util-from-markdown / mdast-util-to-markdown |
If you only need to convert markdown to HTML and don’t plan to use plugins, micromark is a faster, lower-level alternative. If you want direct AST access without the plugin abstraction, mdast-util-from-markdown operates on the tree without any unified overhead.
Feature highlights
remark is the world’s most popular markdown parser and covers a wide range of use cases.- CommonMark compliant — 100% conformance with CommonMark out of the box. GFM (GitHub Flavored Markdown) and MDX are available via plugins.
- AST-based transforms — all processing happens on a structured mdast tree, making it easy to inspect, rewrite, or generate content programmatically.
- 150+ plugins — choose from a rich ecosystem of community plugins for linting, table-of-contents generation, syntax highlighting, math, directives, and much more.
- TypeScript support — the remark organization and the unified collective are fully typed. Types for mdast are available via
@types/mdast. - Runs everywhere — Node.js 16+, Deno (via
esm.sh), and modern browsers are all supported.
A quick example: markdown to HTML
The most common remark pipeline combinesremark-parse, remark-rehype (to cross into the HTML AST world), and rehype-stringify (to produce an HTML string). Here is the complete, runnable code:
.use() call registers a plugin on the unified processor. remarkParse parses the markdown string into an mdast tree; remarkRehype converts that mdast tree into an hast (HTML AST) tree; rehypeStringify serializes the hast tree into an HTML string.
Plugin ecosystem
remark plugins deal with markdown. Some popular examples include:remark-gfm— adds GitHub Flavored Markdown support (autolink literals, footnotes, strikethrough, tables, tasklists)remark-lint— warns about inconsistent or non-conforming markdown styleremark-toc— generates a table of contentsremark-rehype— bridges from the remark (mdast) ecosystem to the rehype (hast) ecosystem for HTML output
awesome-remark curated list, or by browsing the remark-plugin topic on GitHub.