Is there a library that can compile markdown to html with tags for code highlighting?

That's it, that's the question. I use pulldown_cmark for now, but that doesn't seem to have that functionality.

Found this by searching "code highlighting"

I also found https://crates.io/crates/comrak

But I'm interested in what people personally have used.

I've been rolling my own SSG with pulldown_cmark for a while now and have been using syntastica to add syntax highlighting functionality. It's treesitter based so I can better integrate other languages and get highlights for my own syntaxes/languages.

My SSG contains a bunch of other custom stuff related to Liquid, Mermaid, table of contents and frontmatter, so maybe it's not perfect for your use case, but if you are already doing work with pulldown_cmark it might be worth a shot!

2 Likes