Markdownif - Fast and Secure Markdown NIFs built with Rustler and pulldown-cmark

Markdownif implements bindings for pulldown-cmark using Rustler.

Why?

Most of the available libraries that I explored didn’t meet my needs in terms of speed with the exception of markdown. I also wanted to try Rustler and this use case is the perfect fit.

Features

  • Fast: check out the benchmarks
  • Safe: Markdownif defers the NIF execution to the dirty schedulers based on the input size and on measurements around the dirty scheduling overhead.
  • Correct: pulldown-cmark complies 100% with the CommonMark spec

Source: https://github.com/saulecabrera/markdownif

14 Likes

Ooo, so much yes!

Do you support the cmark flags for additional functionality that go beyond the base spec? Not looked at the API yet but plan to use this soon to replace a somewhat custom built thing. :laughing:

Do you support the cmark flags for additional functionality that go beyond the base spec?

@OvermindDL1 Do you mean support for task lists, tables, strikethrough, and footnotes? If that’s the case, those options are indeed supported, when parsing an input you can specify which of these you need, for example:

Markdownif.to_html(input, %Markdownif.Features{tables: true})
2 Likes

Yep that’s what I meant, awesome thanks!

1 Like

Cool! I’ve been thinking of creating a library like this, but with a bonus feature of directly emitting an html tree instead of a string (to avoid reparsing when postprocessing the markdown with HTML processors). I guess I’ll send a PR to this project instead when I come around to doing this :slight_smile:

1 Like

Oh yes, I’ll definitely need the HTML tree as well because I actually transform that to something that’s not HTML. ^.^;