Andrew Mole wrote:
I have just written an extension that uses Steven Chan's PHP scripts (http://www.jcphysics.com/ASCIIMath/) to convert a relatively simple markup language into MathML. The only problem now is that it needs to be presented as XML - currently the output is just displaying as simple text. I remember reading something about mediawiki and XML format, but can't find it again. Is there any simple way of making mediawiki display MathML, or would it need a major rewriting of mediawiki?
You can tell MediaWiki to declare its output to be of type application/xhtml+xml, which will let Mozilla/Firefox interpret eg MathML inline:
$wgMimeType = "application/xhtml+xml";
However there are two basic problems with this: 1) Internet Explorer and some other browsers won't display such pages at all. 2) If there are any XML well-formedness errors in output, Mozilla and other compliant browsers will refuse to display the page.
As for 1), this may or may not matter to you.
As for 2), we try to ensure that MediaWiki outputs valid, well-formed XHTML 1.0 Transitional. However there are not guarantees, in particular with rendering of wikitext there may be odd nesting or improperly closed tags at times. If you enable postprocessing with HTML Tidy, this will probably in most cases fix such errors.
Tidy is controlled by the $wgUseTidy setting; see DefaultSettings.php for other settings which may affect it as well. Tidy comes with most Linux distributions and ports collections, or can be gotten from http://tidy.sourceforge.net/
MediaWiki can shell out to the 'tidy' command-line program, or use the PHP extension wrapping libtidy (but be aware there is a serious memory corruption bug with the current release of the PHP tidy extension, see http://pecl.php.net/bugs/bug.php?id=4202 )
-- brion vibber (brion @ pobox.com)