This is a quick summary for posterity of the changes needed to get MathML output working with Wordpress. You have two options.
This is by far the best plan. To start with, only Firefox is relevant as far as MathML goes, and from 3.6 onwards it has a functioning HTML5 parser. The catch is that it is turned off by default, requiring users to go to
about:config to manually set
true. Because of this, I recommend holding back on using HTML5 until Firefox 4 comes, which will have this turned on by default.
That done, put the HTML5 doctype
at the top of your template, and everything will magically work. You can totally ignore namespaces and just write your
<math> elements anywhere you want (though I am picky and would not, at least because they are needed to embed MathML in your Atom feed—you can forget using SVG or MathML in RSS).
To make Wordpress authoring tolerable, you will need to edit the file
wp-include/formatting.php as described in this bug report.
Use XHTML 1.0
Until HTML5 parsers are more widespread, you will need to serve your page as XHTML 1 or XHTML5. Perform the rough steps above, then serve your pages using an XML MIME type. Wordpress has a good plugin for this.
(Excursus: Personally, I would do it a little differently, as
application/xml are actually quite important to add in, and indeed it is unclear why all the
application/...-xml MIME types are needed at all for SVG, Atom, MathML, RDF, and so on, given that the XML content processing model is to parse and then apply generic XML methods or invoke special support by namespace. In this respect, user agents like Gecko are entirely oblivious to the MIME type and treat all XML, whether generic, Atom, or XHTML in exactly the same way, by namespace. See Ian Hixie’s article on XML in heterogenous environments for further MIME-type-related arguments.)
Some things will break; fix them (at least these changes will be needed, and probably lots of the rest of your site and content is malformed too).
You will also need to make a few changes to your template to remove the
content-type element, and put the XHTML namespace on the
<html> element. Then enter namespaced MathML and it will display fine.
document.write. This is a little annoying, as it is even more important for back-end data exchange and processing tools to be using good XML practices.
That is the price we pay, and the reason to transition to HTML5 as soon as possible. I have read most of the spec and highly praise it, even though there are some outstanding issues. One such relevant to this article is for example the unclarity on how to make a hyperlink in MathML embedded in HTML, since namespaces cannot be used to invoke XLink which is the correct XML way to declare links.
Regardless of these digressions, Wordpress can be coaxed into producing MathML, and in future it will be much easier still.