Question

I know the default way to render the MathML to HTML is placing the MathML code inside and SCRIPT tag, then use MathJax to typeset the elements containing the SCRIPT tags.

I am wondering if there is an easy way to config the MathJax to directly process the MathML code without placing the MathML inside a script tag? So when the MathJax typesetting the HTML elements containing the tags, the MathML can be rendered to the HTML without using any script tags.

This would be very useful when the MathML can be edited on the web and it wants to prevent the editors to input the dangerous scripts by confusing they are the MathML script tags.

Was it helpful?

Solution

The mml2jax preprocessor will find the MathML directly on the page (without enclosing in script tags). All the combined configuration files (e.g., MML_HTMLorMML) include it automatically, so you don't have to do anything special to use it if you are using one of those configurations. If you are doing your own configuration, then include

MathJax.Hub.Config({
  extensions: ["mml2jax.js"]
});

as part of it.

(The mml2jax preprocessor will find the MathML tags and put them into the needed script tags for you, so the page will still include those script tags, but the user doesn't have to type them. Of course, you don't want the user to edit the output of MathJax directly, but rather edit the original markup, so they should never see the script tags.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top