asciidoctor-web-pdf
asciidoctor-web-pdf copied to clipboard
Replace MathJax by KaTeX
MathJax is extremely powerful but does too much. For instance, MathJax is loading additional modules/components at runtime and, currently, it's not straightforward to inline fonts. Also, the rendering is a bit slow and the complete bundle size is pretty heavy.
As an alternative, we could use KaTex: https://katex.org/docs/browser.html
Related issue: https://github.com/asciidoctor/asciidoctor-browser-extension/issues/280
KaTeX does not support AsciiMath out-of-the-box so we need to use https://github.com/christianp/asciimath2tex (or similar) to convert from AsciiMath to LaTeX.
Can you at least make MathJax an optional processor? I was mainly here for the MathJax. I ask because MathJax is very forgiving. We have some complex math equations that I need to convert from MathML to latexmath (via Pandoc) and the conversion is not always ideal. But its good enough for MathJax. Mathjax renders the equation whereas other tools for doing so that I am testing (asciidoctor-latex and asciidoctor-mathematical) are way more fussy and require that I clean up the equations (a non-trivial task when you have thousands of equations). I believe that asciidoctor-mathematical uses the katex library currently...
Can you at least make MathJax an optional processor?
That's a good idea, we could have more than one processor for math formulas (a default processor and one or more alternative processors).
Please note that MathJax is still the current processor and as mentioned in https://github.com/Mogztter/asciidoctor-web-pdf/pull/315 KaTeX lacks some features so we won't make the switch anytime soon.