Rendering LaTeX in Markdown with actual LaTeX

56 points dangling-ptr

https://github.com/ma-chengyuan/just-latex

I just wrote a simple Pandoc filter that renders LaTeX fragments in markdown with just LaTeX itself over the past weekend. I intend to use it for my blog but it's probably also worth sharing.

The readme contains a comparison with MathJaX/KaTeX, and with TeX4ht. Basically it allows you to use pretty much all of LaTeX's ecosystem. In the demo page I use cmbright to switch to a more screen friendly font, make a plot with tikz and some pseudocode with algpseudocode. All seem to be working great, in just 600 LoCs.

Under the hood it links to the synctex library for basic synchronization, uses usvg to refine the crop regions in the generated SVG, and compresses the resulting image with LZMA to save bandwidth. Rust really is the perfect language for such task: linking to low level C library is pretty much painless and at the same time it has a rich collection of really powerful high level libraries!