Markdown libraries
Markdown parsers convert Markdown to HTML and most also expose a syntax tree. Prefer a CommonMark-compliant parser: it gives the same result as other compliant tools for the core syntax. Check which GFM features (tables, task lists, strikethrough, autolinks) and other extensions (footnotes, front matter, heading IDs) you need, and whether raw HTML is escaped by default when you render untrusted input.
| Language | Library | CommonMark | GFM | Notes |
|---|---|---|---|---|
| C/C++ | cmark | yes | no | the CommonMark reference implementation, C, very fast |
| C/C++ | cmark-gfm | yes | yes | GitHub’s fork of cmark, used to render github.com |
| C/C++ | MD4C | yes | yes | small SAX-style C parser, no AST, used by Qt |
| C# | Markdig | yes | yes | the standard .NET parser, 20+ extensions, roundtrip AST |
| Java | commonmark-java | yes | yes (extensions) | small core, extension modules, Markdown renderer |
| Java | flexmark-java | yes | yes | many extensions, HTML-to-Markdown, DOCX/PDF export |
| Go | goldmark | yes | yes | used by Hugo, extensible, standard library only |
| Python | markdown-it-py | yes | yes (plugins) | port of markdown-it, token stream, used by MyST and Jupyter |
| Python | Python-Markdown | no | partly (extensions) | used by MkDocs, many extensions, original Markdown rules |
| Python | mistune | mostly | yes (plugins) | fast pure Python, AST output, plugins |
| Ruby | commonmarker | yes | yes | Ruby binding of comrak (Rust), syntax highlighting |
| Ruby | kramdown | no | with kramdown-parser-gfm | Jekyll’s default, own dialect, many output formats |
| Ruby | Redcarpet | no | partly | fast C extension, custom renderers |
| Rust | pulldown-cmark | yes | yes | pull parser (event iterator), used by rustdoc and mdBook |
| Rust | comrak | yes | yes | port of cmark-gfm with an AST and many extensions |
| PHP | league/commonmark | yes | yes | the standard PHP parser, extensions, AST |
| PHP | Parsedown | no | partly | single file, fast, simple |
By language#
- Markdown libraries for C/C++ Open-source C/C++ Markdown parsers: cmark, cmark-gfm and MD4C. CommonMark and GFM support, AST vs callback APIs, with code examples.
- Markdown libraries for C# Markdown parsing in C# and .NET with Markdig: CommonMark, GFM tables and task lists, 20+ extensions and a full syntax tree. Code examples.
- Markdown libraries for Java Markdown parsing in Java with commonmark-java and flexmark-java: CommonMark, GFM extensions, AST visitors, and conversion to HTML and back. Comparison.
- Markdown libraries for Go Markdown parsing in Go with goldmark: CommonMark-compliant, GFM extensions, extensible AST. Code examples for converting Markdown to HTML.
- Markdown libraries for Python Markdown parsers for Python: markdown-it-py, Python-Markdown and mistune. CommonMark compliance, extensions, AST access, with a comparison and code examples.
- Markdown libraries for Ruby Markdown parsers for Ruby: commonmarker, kramdown and Redcarpet. CommonMark and GFM support, extensions and output formats, with code examples.
- Markdown libraries for Rust Markdown parsers for Rust: pulldown-cmark and comrak. CommonMark and GFM support, event iterator vs AST, with code examples.
- Markdown libraries for PHP Markdown parsers for PHP: league/commonmark and Parsedown. CommonMark and GFM support, extensions and security options, with code examples.