2007-09-16 part 2

09/16/2007 16:00:00

I have made a great stride in MathML support for MultiMarkdown today. Specifically, I found the Text::ASCIIMathML module for Perl. Previously, I had relied on a php script to provide ASCIIMath support, which always seemed like a cruch, since the rest of MultiMarkdown was written in Perl.

So after discovering this module, I rewrote MultiMarkdown to use that module to provide built-in support for math equations. This will have multiple beneficial effects:

  • PHP is no longer required

  • there is more flexibility in how math is identified, since the main MultiMarkdown program is now aware of the math syntax

  • it is possible to add MathML support to web software that uses MultiMarkdown — including, as of today, this web site.

To see MathML in action:

<< e^(i pi) + 1 = 0 [Euler’s identity]>>

<< x_(1,2) = (-b+-sqrt(b2–4ac))/(2a) [quadratic equation solution]>>

This is, of course, subject to the usual limitations of MathML. Specifically, many browsers do not support it. I cannot vouch for other setups, but this works for me when using Firefox with the MathML font support installed.

There are multiple tricks required to get MathML to display properly, including setting the proper DOCTYPE and xmlns settings for the <html> element, and setting the proper HTTP Header (application/xhtml+xml).

Safari doesn’t support MathML, and I don’t pretend to care whether Internet Explorer supports it properly.

I still have a few kinks to work out, but this will be ready when I release 2.0.b4 (hopefully soon, depending on how busy work keeps me.)

Similar Pages