logoalt Hacker News

bArraytoday at 12:06 AM0 repliesview on HN

One problem I ran into a long time ago (2021) is that MathML was not well supported in Chrome and other browsers, but seemed well supported in Firefox.

After trying many Pandoc options [1] I ended up selecting a very small implementation by Preet [2] which was some ~70kB [3] compared to other implementations at about 10x (i.e. MathJax [4]). I use it with the Polyfill to check if it is already supported. If you checkout the torture test, it really performs quite well [5].

In the future I still want to convert to SVG vectors (with bitmap backups) and include those instead, but I'm not yet pleased with the offerings. My concern with JS is that it seems to be on the way out, I think it will eventually go the way of Flash in favour of something else.

With the current solutions for rendering equations you either have this ridiculous wrapper around LaTeX or similar, or some other weirdness. If I get bored for a few days I might end up writing a parser to convert MathML to such outputs. It shouldn't take insane efforts to pass some torture tests.

[1] https://coffeespace.org.uk/projects/mathml-render.html

[2] https://github.com/pshihn

[3] https://github.com/pshihn/math-ml

[4] https://www.mathjax.org/

[5] https://pshihn.github.io/math-ml/examples/torture.html