MathJax upgrade interest?

At the conference, @omar mentioned to me that MathJax 3 was a complete overhaul of the library that significantly improves performance, reducing render times by as much as 80% in some cases. But it’s also not entirely backwards compatible with 2.x, making the upgrade non-trivial.

Is anyone currently looking into this? Are there compelling author-facing features that you’d want to use that only appear in 3.x?

4 Likes

@navin could talk about this.

See feat!: upgrade to mathjax v3 by navinkarkera · Pull Request #33555 · openedx/edx-platform · GitHub

2 Likes

@dave We did implement the changes required to upgrade MathJax to 3.x in the above linked PR but we had to postpone work on it due to requirement of supporting multiple versions of MathJax via course level advanced settings which is not trivial.

@jristau1984 Since we started this upgrade work as part of Buglist project, I would like to hear your thoughts.

1 Like

Thanks @dave. I think we should ping people who uses MathJax the most including 2U authors and MIT team (@pdpinch). We need to make sure they’re at least aware of the changes and whether we’ll need to keep the deprecated version behind an off-by-default feature flag for a release or two to cater for breaking changes we’re not aware of.

I’ve added few notes but so far the work looks good.

@navin: Was the extra work mostly concerned about the coding side of things, or was there concern that there’d be a lot of bug fixing cycles on this as part of a gradual rollout? Or both? I’m curious about how much effort you think remains to land that work.

Jeff Witt summarized his expectations here: fix: Upgraded Mathjax version from 2.7 to 3.0.1 by Yagnesh1998 · Pull Request #32418 · openedx/edx-platform · GitHub.

This is the guidance we were working under, and with the hours available in what Navin was referencing, it did not fit.

I forgot that MathJax 4.0 was already in beta. Does it make sense to wait for that to land and try to go straight from 2.x → 4.x?

1 Like

@dave Due to the complete rewrite of mathjax in v3 and change in the way of queuing operations gradual upgrade would mean supporting both versions with completely separate sections of code so yes it includes time for coding as well as fixing lot of bugs.

I forgot that MathJax 4.0 was already in beta. Does it make sense to wait for that to land and try to go straight from 2.x → 4.x?

Yes, but do we also add support for other versions as mentioned in Jeff Witt’s comment.

Hi Friends/Colleagues/Peers, good day! Just wanted to share the exciting news that MathJax v4.0.0 has just been released (minutes ago), and (as a math researcher/educator) I’m registering my keen interest in getting to know more about Open edX’s potential upgrade in this regard :smile:! Much appreciated :heart:!

2 Likes

Hi @ziqifang! Welcome to the forums!

Thank you for letting us know about the long-awaited 4.0 release of MathJax. :grinning_face:

We need to get consensus around how to move forward with MathJax. Normally a dependency upgrade like this would be tracked by the Maintenance Working Group, but MathJax is unusual in that we have to worry a lot about content compatibility. I remember an earlier MathJax upgrade cycle where we were perpetually chasing down issues where system-wide tweaks in MathJax configuration to fix one set of content would unexpectedly break another–and the jump from 2.x to 4.x is likely to be even more disruptive.

At a platform level, we clearly need to support Math display. It sounds like there are an increasingly large number of ways to do that, with various tradeoffs in compatibility and accessibility. We also need to figure out if we need to make this selectable and configurable at a more granular level (e.g. site vs. course vs. an individual piece of content), as well as map out a more long-term strategy for how we want to preserve math content (maybe with a heavier reliance on MathML?). We also need to figure out what our default configuration is going to be, what RTL support looks like, and probably a half dozen other things that I’m forgetting.

I think this needs someone to actually own it and write a coherent product proposal. Are there any volunteers for that? @pdpinch: Do you folks have someone who might be interested in taking this on?

1 Like

Dear Dave (@dave)! It’s incredibly nice to (virtually) meet you!!

Thank you for your informative reply. Previously I only had some vague ideas about “what’s next” but your message greatly helps putting the “what it takes” into perspective. I very much appreciate that!

And thanks for sharing your experience with the earlier challenges in MathJax upgrade—I hear you! If it’s any consolation, it is my (preliminary) impression that the required effort of jumping to v4 would probably not be twice as hard as that of jumping to v3 (and maybe even a potential head start if there was already lots of work done from v2 towards v3). This is suggested in their v4 upgrade documentation:

“Because version 3 was a complete rewrite of MathJax, the API had major changes from version 2 to version 3, making that upgrade one that could require significant work. That is not the case for upgrading from v3 to v4. The API for v4 is largely the same as v3, with most changes being additions rather than changes. […]”

Also thanks for resurfacing Jeff Witt’s comment on the Platform repo; and I remembered he had also commented something similar in a post on the Canvas LMS forum. I learnt something useful from both posts. As a “fun fact” and a particularly good sign, one of the notable issues of v3 which he prefaced both posts with—i.e., the line-breaking issue—has been addressed by the much improved line-breaking support in v4.

Last but not least, thanks so much for encouraging work from us in this direction, and particularly thanks for pinging Peter (@pdpinch). I was a bit too excited getting ahead of myself yesterday and forgot to introduce myself: I’m one of the MITx folks (I’m a newbie though!) and I’ve been benefited a lot from the work/guidance of Peter and the Engineering Team at MIT Open Learning; if Peter / Open Learning takes interests in this, then I’m more than happy to try my best working on any aspect where I may be of use :grinning_face:

Sincerely,
Ziqi

Hi @ziqifang, Thank you for sharing the new release information with us.

I agree, we do have a PR that upgrades MathJax v2 to v3, but it was done a long time ago and the platform has changed quite a lot since then, so it will still take some effort to upgrade. And as @dave pointed out, we need to decide whether we want to support multiple versions and if yes, we need to decide at what level this could be configurable.

Since I have some context with regards to the upgrade, I would like to help here.

1 Like