lzanini / mdbook-katex

A preprocessor for mdBook, rendering LaTex equations to HTML at build time.
MIT License
193 stars 34 forks source link

Call for PR: use Pulldown-CMark to extract match expressions #116

Open SichangHe opened 1 month ago

SichangHe commented 1 month ago

Context

Currently, mdBook-KaTeX uses simple heuristics I hand-rolled to identify and extract math expressions. Various Markdown markups are not handled, e.g., indented code blocks and HTML.

Recently, Pulldown-CMark started supporting math. This is some great news, as Pulldown-CMark should be much more robust and feature-rich in this regard.

To reliably convert Pulldown-CMark events back to Markdown text, it would also be nice to wait until Pulldown-CMark-to-Cmark supports preserving escape characters.

Pushback

The reasons I am not very interested in implementing this myself are as follows:

If anyone is interested in this, please try and make a PR!

SichangHe commented 1 month ago

Another regression would be Pulldown-CMark does not support custom math delimiters like we do now.