Enable HTML in KaTeX formulas

With https://katex.org/docs/supported.html#html enabled we could put classes on parts of formulas.

This would enable us to hide parts of formulas and reveal them only on hover for example (similar to the actice recall scroll). This could be done even in queue. Combine this with some dummy clozes somewhere on the rem this would be a quick&dirty way to have spaced repetition inside latex formulas:

$$\htmlClass{hide}{F} = \htmlClass{hide}{m} \cdot \htmlClass{hide}{a}$$ (Clozes: {{1}}, {{2}}, {{3}}).

It could also be somewhat used to turn parts of latex into references?

Regarding security you could:

  • Sanatize the input from everything the user has not typed themselves removing all those special commands when content comes from outside.
  • Define the trust option per formula and trust: false for everything the user has not typed.