MathML on the Web – Please!
Today I merged a pull request for Authorea which introduced the following setup for equation editing, as an alpha feature for our RichText editor:
The “status quo” MathJax renderer, displaying the mathematics on all ”read-mode” article components.
A new KaTeX renderer, specifically loaded in the iframe of our editor widget. Why? Because loading MathJax twice is too slow for our show, but we still want our displayed richtext equations to be, well, rich.
An additional math renderer, part of our equation-specific editing widget, so that authors can also input formulas in an appealing richtext flow.11We also have an upcoming equation button palette to put the WYSIWYG cherry on our cake. See the great demos by MathQuill for examples.
You read that correctly - not one, not two, but three separate math renderers on the same HTML page, each of which different due to balancing on the trade-offs of performance, coverage and visualization.
I hear you cry:
– Well, this is clearly horrible design, simplify and streamline it!
Indeed! My thoughts exactly. But the great solution, the one that solves this problem not only for me, but for the entire math-on-the-web developer ecosystem, is not for me or my team to implement.
This renderer medley can be traced to a single root cause - the absence of ubiquitous MathML support in modern browsers. If you are not familiar with MathML, it is a W3C and ISO standard and a core part of HTML5. MathML does a great job of providing a single language for representing mathematics in structured documents, especially web pages. But while we have that great language, we lack major browser implementations – in fact only Firefox has great MathML support, and has long been the browser-lead in math support.
A different perspective tells us that we are just two browsers short of having the tide turn overwhelmingly towards native MathML rendering. I am referring specifically to Chrome and Edge. Having native support would allow us – the mortal developers interested in providing exciting and powerful math-enabled web applications – to sleep calmly at night and work proudly at day. And hence my sincere plea to all major browser vendors:
P.S. How is the native MathML solution better?
Best. Performance. Possible.
Your browser will be capable to render MathML the moment it loads, just as it can CSS. No extra load times needed.
The DOM will set you free
As math-on-the-web developers, we need to select into and manipulate mathematical objects, just as all web developers need to manipulate forms and input fields. I want my cool math interactivity widget to be an easy drop-in for any webpage, just the same way that a jQuery widget is. And we can’t have that without equations being a proper participant in the HTML DOM – CSS would have never taken off if say
<span>elements only existed for sites that had first loaded a third-party
P.P.S. If you are interested in showing your personal support for adding native MathML, add your vote and voice to the public issues:
Chrome MathML support: https://code.google.com/p/chromium/issues/detail?id=152430