# MathML and SVG in HTML 5 with Firefox

I’ve been using MathML for a while now for some of my documentation work on 3D graphics. Unfortunately the only way at the moment is to use XHTML 1.1 modular doctype to include either or both of MathML and SVG. In HTML 5 these have become embedded content parts of the specification. So for example, using MathML would be as simple as doing:

[html]<!DOCTYPE HTML>
<html>
<meta charset="utf-8">
<title>MathML test</title>
<body>
$<mrow> <mi>y</mi> <mo>=</mo> <msup> <mi>x</mi> <mn>2</mn> </msup> </mrow>$
</body>
</html>[/html]

Unfortunately the only browser to support either MathML or (parts of) HTML 5 at this moment is Firefox 3.5. However, the MathML or SVG embedded content did not render under 3.5. After reading John Resig’s post about a new HTML parsing engine in Mozilla’s Gecko engine I set out to test this engine’s support  by downloading the latest nightly and setting html5.enable to true in about:config and ‘lo and behold, it renders as expected.

## 3 thoughts on “MathML and SVG in HTML 5 with Firefox”

1. Fredo says:

Just one thing I don’t entirely understand: If Firefox 3.5 is the only browser with sufficient HTML5 support, but Firefox also and for some time now supports XHTML1.1, why would one need MathML in HTML5? Is it just about saving that few characters for the namespace declaration?

2. Well, the problem lies that XHTML 1.1 needs to be sent as application/xhtml+xml and any malformed document tends to trigger very scary, for an end-user, messages about wellformedness. Add to that that now the XHTML 2 work group will be disbanded later this year, the only new HTML specification will be HTML 5. So the only option you have in the near future will be HTML 5 for MathML.
The best part is that SVG and MathML are integral parts of the specification. So this means that we can finally see some more widespread implementations. My Opera contact says that there’s work done, so maybe Opera will add more support for it in the 10.x release series.
I also have good hopes that Chrome/Chromium will add this support.

3. Ben Crowell says:

Re Fredo’s comment, I think the issues are that (1) xhtml failed to be widely adopted, so it’s seen as a dead end, and (2) people want to be able to write a single web page, rather than a nonstandard one for IE and a standard one for every other browser. If I write html5+mathml, then (in the very near future), firefox will render it correctly, and IE users will at least get some rendering of the page that will be somewhat readable.