gjtorikian / commonmarker

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

latex bug with multiple $ in a line #183

Closed rain-1 closed 2 years ago

rain-1 commented 2 years ago

I created this bug at the parent repo. But I believe an issue here may be useful too https://github.com/github/markup/issues/1562

kivikakk commented 2 years ago

CommonMarker doesn't do any rendering of LaTeX, so I think this one's just for GitHub's own pipeline.

rain-1 commented 2 years ago

really? There is a function called render latex https://github.com/gjtorikian/commonmarker/search?q=LaTeX

kivikakk commented 2 years ago

Indeed! cmark-gfm, which we wrap, has $\LaTeX$ output:

$ printf '# Hello, world!\n\nLaTeX output from [cmark-gfm](https://github.com/github/cmark-gfm).' | cmark-gfm --to latex
\section{Hello, world!}

LaTeX output from \href{https://github.com/github/cmark-gfm}{cmark-gfm}.
$

We build all of cmark-gfm inside CommonMarker, so those source files you're seeing are just those. We don't (yet) expose the ability to render to LaTeX from CommonMarker, though it would be trivial to do so.

This is all quite different to GitHub's offering, which is a MathJax-based (client-side) render. See Writing mathematical expressions in GitHub's docs for some information.