Markdown libraries for C/C++
Three C libraries cover Markdown, all CommonMark-compliant:
- cmark is the CommonMark reference implementation by the spec’s authors. It builds an AST you can walk and modify, and renders HTML, XML, LaTeX, man pages and normalized CommonMark. No GFM extensions.
- cmark-gfm is GitHub’s fork of cmark with the GFM extensions (tables, strikethrough, autolinks, task lists, tag filter) and footnotes. It’s what github.com uses. Pick it when you need GitHub-compatible output with an AST.
- MD4C is a small, fast parser with a SAX-like callback API and no AST. It supports GFM features through flags, plus LaTeX math and wiki links. Qt uses it. Pick it when you render straight to your own output (a GUI widget, a custom format) and want minimal code.
All three are safe by default: raw HTML and javascript: links are suppressed unless you pass an “unsafe” option.
- cmark cmark is the CommonMark reference implementation in C. How to install it, convert Markdown to HTML, walk the syntax tree to find headings and links.
- cmark-gfm cmark-gfm is GitHub's C library for GitHub Flavored Markdown, a fork of cmark with tables, task lists, strikethrough and autolinks.
- MD4C MD4C is a fast, small Markdown parser in C with a callback (SAX-like) API and GFM support. How to install it, render Markdown to HTML and walk headings.