HTML5: Possible implications for technical documentation

A New Version of HTML

As you may have heard, HTML5, a new version of HTML, the main markup language for the web is under development. This is the first version for quite some time, HTML4.01, the current version, was released in December, 1999. There was an XML version, XHTML 1.0, XHTML (Released in January 2000 and revised August 2002), but it did not contain any new features.

Much of the buzz around HTML5 concentrates on new features such as video (as an alternative to using flash plugins etc) and canvas (a JavaScript API for 2 dimensional graphics), but in this article I want to look at the features that impact on the kind of technical, mathematical documents used by NAG.

SVG and MathML

SVG is an XML format for describing scalar graphics, using a similar graphics model to PostScript or PDF, but using XML syntax and CSS for styling, just as for HTML. It has been around for some years, but HTML5, for the first time, specifies how it works in the context of HTML (rather than XML). In a related move, Internet Explorer 9 will support SVG. (Other common browsers have supported it for some years.)

Many of the function plots in the NAG documentation are generated from gnuplot. Gnuplot can save to SVG as well as the EPS and PNG outputs that we currently use. Also the remaining diagrams are currently stored as EPS (for use in PDF versions of the document) and EPS can usually be converted without any loss of information to SVG.

There are many advantages to using a scalable format for plots, especially documents that are read on smaller devices such as tablets (or phones), but also printing at higher resolution; being able to scale and zoom in as required without the loss of quality inherent in scaling bitmap images is a big win.

The other XML-derived language supported natively by the HTML5 parser is MathML. MathML should be familiar to most NAG users as it has been used in the XHTML version of our documentation for years. However being able to use MathML in HTML should hopefully simplify the installation of this documentation, and also the prominence given to MathML by its inclusion in HTML5 will also hopefully encourage the remaining browser vendors, who do not natively support it, to implement mathematics rendering in their browsers.

Current State of (Future) Browsers

All the common desktop browsers are moving towards supporting HTML5 in the near future. The following sections list the state of SVG and MathML rendering in some common cases.

Internet Explorer 9 Beta

IE 9 finally adds SVG support to Microsoft's Internet Explorer browser. Design Science's MathPlayer may still be used to get very high quality rendering of MathML. There are currently some problems in interfacing MathPlayer and IE 9, and some of the markup that worked in IE 8 no longer works, however this may be fixed before the full product comes out, or a few lines of IE-specific javascript, as used in the example below, may be used to work around the main problems.

Warning: IE 9 Beta, unlike all the other test releases of browsers mentioned here will replace your existing Internet Explorer installation. If you wish to test IE 9 rendering without removing your IE 8 (or earlier) installation make sure that you install the Platform Preview rather than the Beta. The platform preview releases use the IE 9 rendering engine but without all the normal browser menus and facilities, and it does not replace your existing browser.

IE 9 Beta 1 was tested.

Firefox 4.0 Beta

Firefox 4 uses the new HTML5 parser which automatically places MathML elements in the MathML namespace and SVG elements in the SVG namespace. The rendering of MathML and SVG in HTML 5 is then essentially exactly as has been available in earlier Firefox releases in XHTML documents, but now also available in HTML.

Firefox 4 Beta 6 was tested.

WebKit Nightlies

A Nightly release is a public binary release that is essentially just a snapshot of the current development build. As such it is expected to have bugs and unimplemented features. However these releases, which show the development state of the core rendering engine used by both Chrome and Safari browsers show that it has a reasonably well developed SVG renderer, and that MathML support, while very new, is improving. (These WebKit browsers have very good CSS support so until the native MathML is ready for use it will probably be possible to use a CSS rendering of MathML in these cases, as is done for the current NAG XHTML documentation).

WebKit-r67637, from 16th September was tested.

An Example

We do not yet have any definite plans or dates to move towards using HTML5, it depends a lot on the timing of the above test releases becoming mainstream (which is likely to be very soon) and how long it takes for use of older browsers to die out. (This can take a long time, many people only change their browser when they get a new machine, Internet Explorer 6 (released in 2001 and replaced by IE 7 in 2006 and IE 8 in 2009) is still in widespread use for example.)

As an experiment we have converted one example routine document into HTML5, using inline MathML and SVG. Note in the example all links to external documents have been made to point back to the test document so that it is self-standing. The document has 207 MathML fragments, which are essentially unchanged from the existing XHTML+MathML version of the document, the two plots shown in the example section, which were previously only available as monochrome scalable images in the PDF version of the document, or a coloured PNG bitmaps in the XHTML version, are provided as scalable SVG which is directly included into the HTML file, not referenced using <img src=....

The document is reported as valid HTML5+SVGMathML by the online validator.

The document appears to be perfectly usable in Firefox 4 and IE 9. The MathML support in WebKit is still very new, and there also appear to be some problems with the SVG which get rendered with a black background in the Windows nightly build of 16th September. Note however that, as their name suggests nightly builds are unstable test releases and should not be taken as indicative of the final product. The fact that the SVG was fully rendered apart from some colour problems, and that the MathML was recognized, albeit with some rendering problems, is I think a good sign that WebKit based browsers (Safari, Chrome, and many mobile phone browsers) will support these documents in the near future.

Fortran Library Mark 22 Routine Document (D02AGF)
XHML+PNG+MathML Mark 22 Documentation d02agf.xml
PDF Mark 22 Documentationd02agf.pdf
HTML5+SVG+MathML Experimental d02agf.html


HTML5 will be mainstream in currently popular browsers very soon, it will take a few years before its use may be assumed, but it promises to be a big improvement for technical documents.

Both MathML and SVG allow the use of scalable formats freeing the web from the use of inappropriate bitmap images. This simplifies document distribution and should improve the quality both for printing and for use on a wider range of devices, including greatly increased accessibility.


Popular posts from this blog

Implied Volatility using Python's Pandas Library

C++ wrappers for the NAG C Library

ParaView, VTK files and endianness