Page MenuHomePhabricator

Update to MathJax 3
Open, LowPublic


Mathoid currently uses MathJax version 2 to convert the LaTeX dialect texvc to standard HTML (nativeHTML) and SVG fallback images. Now, MathJax 3 dropped support standard HTML5, but introduced a new variant they call common HTML. However, it seems that the internal MathML representation is still available from the API.
The update will improve the experience for most users, which is a very strong argument to update. I could not figure out if the new CHTML mode works without javascript enabled in the client. I think it should, but I could not find the information.
Preliminary analysis:

  • verify that the page can be rendered without javascript
  • verify that there are no significant regressions for users using the native MathML rendering


  • one-pass rendering. No external images
  • use upstream fixes


  • Please add your points here.

Related Objects


Event Timeline

The deeper I investigate the situation, I get the impression that this update will be a big advancement. I can't see any disadvantages up to now.

I think the way to go forward is to introduce a new rendering mode and then phase out the current rendering mode. Otherwise regressions are too likely.

@Physikerwelt Thank you for creating this ticket, I think this change is long overdue. What are your thoughts regarding the implementation, in particular:

  • does the new rendering mode still need this restbase setup? I am just asking because getting rid of this would greatly reduce the complexity and dependencies, would make it much easier for people to contribute to the development of the math extension and install it on their own servers.
  • as far as I know the legacy rendering mode for mhchem package is no longer supported in mathjax 3.0. In my opinion this should not block the transition to the new rendering mode because this change is also long overdue, we just have to keep in mind that it will break some mhchem formulas. I can take care of this and make sure that they will get fixed.
  • the new rendering mode should conserve the original LaTeX input, i.e. not have something like texvcjs (T188879). The necessary syntax modfications are done (T197925), except for those that we could not extract from the database dumps. If we want to fix those pages we need the new rendering mode assigning error categories in real time.
  • we should take the new rendering mode as an opportunity to discuss getting rid of "default" rendering mode and making the "default" without parameters "inline" (textstyle).

Just a warning that accessibility has changed considerably in V3. I filed a MathJax issue that has some discussion about the inaccessibility of V3 out of the box. If the output is to be accessible, MathML needs to be hidden as was done in V2 and is currently done on wikipedia pages. In V3, the way to include MathML is described here. MathJax may change it's defaults in some configurations based on the inaccessibility as V3 currently exists; definitely check the output for hidden MathML if you switch to V3.

@Debenben maybe the most effective way of making progress would be a short chat on Skype on the phone. Just let me know if you are interested.

A few MathJax updates:

  1. They have fixed the accessibility problems.
  2. mhchem is supported in V3, although details have changed.
  3. They just announced V3.0.5 saying they have enough confidence in it to officially announce V3 for general usage.

@SalixAlba this was scheduled for the Tirana Hackathon. With MathJax V3 the problem of whitespaces as you mentioned in T140217 might be resolved anyhow. However, with the common HTML layout, we will lose semantics and become more dependent on the features of individual browsers.