Release: comrak (CommonMark + GFM compatible Markdown parser)


Hi all! I’m kivikakk, one of the engineers who worked on GitHub’s transition to CommonMark. I’ve also done a lot of work on our fork, cmark-gfm, of the reference CommonMark implementation cmark.

The work I did there made me interested in pushing CommonMark adoption in general — pulldown-cmark is great (and fast!), but is currently lagging behind the spec. I did a more or less straight port of cmark-gfm from C to Rust, resulting in comrak. It’s available on now.

The relative advantages of comrak are that it’s based on a 1:1 translation of the reference cmark implementation, meaning upstream spec changes can be translated and adapted with relative ease — the parsing strategy is identical, so the risk of a spec change being difficult to adapt is extremely low. Further, it’s based on the exact code we run in production at GitHub, including the extensions to CommonMark (table/strikethrough/autolink/etc.), so it’s guaranteed to e.g. render your the same way we do.

The relative _dis_advantage is that it’s a bit slower than the competition. Raph reported pulldown-cmark ran faster than cmark in this discussion — comrak runs at about 4.5x 1.9x the runtime of cmark. This still places it between discount and cmark itself in the cmark benchmarks.

I’m also pleased to report that it’s now being used for rendering Markdown in as of onur/! :tada:

This is my first piece of published Rust code, so I’m really interested in feedback on the API, improvements to the codebase itself, and so on. I’d like to drive CommonMark adoption in general, and I hope this is one way to contribute to that while also contributing to the Rust community.

Thanks for reading!



I saw the tweets about this; I’m incredibly excited! We’ve landed a change from hoedown -> pulldown-cmark in Rustdoc; we’ve wanted the Rust ecosystem to use CommonMark for a long time, and finally made it land. The news about GFM was then extra extra exciting!

I don’t have time to literally read the code right now, but will certainly do so and send you some issues/prs/whatever when I do :smile:


I got some great help from @killercup, and we’re now up to 1.9x cmark’s runtime speed (from 4.5x). :tada: