Comrak parses and renders CommonMark and GitHub Flavored Markdown in Rust, as a library, CLI, and language bindings. It targets CommonMark 0.31.2 by default.
Overview
Comrak is a Markdown parser and renderer that implements CommonMark and GitHub Flavored Markdown. You can use it from Rust code, from a standalone command-line binary, or through bindings for Ruby, Python, JavaScript, and other languages, including a WebAssembly build for browsers.
By default it follows CommonMark 0.31.2. GFM extensions can be toggled collectively or enabled individually, alongside many Comrak-specific extensions such as alerts, footnotes, math, wikilinks, and Obsidian-oriented features. Parsing can produce HTML directly or build an AST you manipulate before rendering.
Security-minded defaults scrub raw HTML and dangerous links unless you opt into unsafe mode. Optional plugins add syntax highlighting for fenced code blocks, including a Syntect adapter. Custom formatters can override rendering for selected node types without rewriting the whole pipeline.
The CLI is packaged for several Unix package managers and via cargo install. GitLab and other products use Comrak to render Markdown in documents and UI surfaces.
Key features
- CommonMark 0.31.2 compliance
- GitHub Flavored Markdown extensions
- AST parse and custom render path
- Safe default HTML sanitization
- Pluggable syntax highlighting
- Many community Markdown extensions
- CLI and multi-language bindings
- WASM use in web pages
Use cases
- Rendering Markdown in applications
- Converting Markdown via CLI pipelines
- Git-hosted README generation
- GFM-compatible documentation sites