remark parses CommonMark markdown into an mdast tree, lets plugins transform it, and serializes markdown or feeds HTML via companion tools. A CLI can check and format files in projects.
Overview
remark is a JavaScript ecosystem for treating markdown as structured data. Plugins operate on mdast syntax trees so programs can lint, extend, or rewrite markdown consistently with the unified content framework.
Core packages include remark-parse for markdown input, remark-stringify for markdown output, the combined remark shortcut when both ends are markdown, and remark-cli for terminal-based inspection and formatting. CommonMark compliance is built in; extensions such as GFM or frontmatter arrive through plugins like remark-gfm.
remark pairs with rehype when you need HTML output, often through remark-rehype. Popular plugins add tables of contents, lint rules, and GitHub-flavored syntax. Documentation recommends micromark for simple markdown-to-HTML without plugins, and mdast utilities when you want manual tree control.
Security guidance notes XSS risk when markdown becomes HTML and suggests sanitization in the HTML stage, plus reasonable size limits because very large documents can be expensive to parse. The stack targets maintained Node.js releases and provides TypeScript types for plugin authors.
Key features
- CommonMark markdown parsing
- mdast syntax tree model
- 150+ community plugins
- remark-cli format and lint
- GFM via remark-gfm plugin
- remark-rehype HTML pipeline
- TypeScript plugin typing
- unified core integration
Use cases
- Markdown linting in CI
- Docs site markdown processing
- GFM tables and task lists
- Automated markdown formatting
- Custom markdown transformations