gjtorikian / commonmarker

Ruby wrapper for the comrak (CommonMark parser) Rust crate
MIT License
416 stars 80 forks source link

Mermaid support in commonmarker #253

Closed DaveKriewall closed 9 months ago

DaveKriewall commented 9 months ago

I'm building a jekyll-powered web site, and my markdown contains mermaid diagrams. Using the default markdown renderer kramdown, these diagrams appear correctly. When I switch to commonmarker, I'm getting an image stating that there's a "syntax error in text":

image

I tried very simple Mermaid diagrams and they all fail in the same way.

I'm using commonmarker 0.23.10. I upgraded Mermaid to 10.4.0 without any improvement.

Am I missing some additional option?

gjtorikian commented 9 months ago

The commonmarker spec which this project adheres to, does not support Mermaid diagrams. You can see the list of additions which Kramdown has made. Your best bet to unblock yourself is to use a JavaScript rendering library like MathJax or KaTeX. Alternatively, you can ask the Kramdown folks how their implementation works, and possibly run a postprocessing script after commonmarker runs to convert the diagrams into SVG or whatever kramdown does.