Created by: Quuxplusone
This minor change in mml2jax
allows you to write inline math markup just like you would on Wikipedia or Stack Overflow: <math>1+2=3</math>
. We accomplish this by mixing the "mml2jax" preprocessor (which knows how to find math tags) with the "tex" middle-end (which knows how to render TeX input).
The one complication is that the TeX middle-end expects to see the text without the surrounding <math> ... </math>
, whereas the MathML middle-end expects to see it with the surrounding <math> ... </math>
. So if we're outputting to the TeX middle-end, we need to take innerHTML
instead of outerHTML
.
To test the functionality, copy mml2jax.js
from unpacked/extensions/
into extensions/
, and then open index.html
in a Web browser. You should see two identical display-mode equations: one rendered by <math mode=display> ... </math>
and one rendered by \[ ... \]
.
I plan to use this extension on my blog, which uses Jekyll, and where I don't trust myself to avoid writing \(
or \[
or $$
by accident. Whereas I definitely do trust myself to never write <math>
by accident!
Fixes #2043 (closed).