rootstock
rootstock copied to clipboard
Plugin: upgrade MathJax to version 3
MathJax has released v3.0 which claims to be rewritten from the ground up.
- http://docs.mathjax.org/en/v3.0-latest/upgrading/whats-new-3.0.html
- https://github.com/mathjax/MathJax/releases/tag/3.0.0
So probably worth upgrading and perhaps it will resolve some of the math related issues.
Originally posted by @dhimmel in https://github.com/manubot/rootstock/issues/165#issuecomment-567568278
It looks like we need to change the following line:
https://github.com/manubot/rootstock/blob/579547d8140dd01ddf652dfd4dbeb6c4a2c4b0eb/build/plugins/math.html#L14
If we can just pin the MathJax version to MAJOR.MINOR and use the latest patch that would probably be a good idea. Not sure if that is possible with cdnjs URLs? @vincerubinetti do you know?
Also @vincerubinetti would you be able to check that upgrading to 3.0 won't break the plugins?
As far as I can tell CDNJS doesn't give a way to link to the latest patch version, or even the latest version in general. Maybe it could be done with their api. This SO post seems to suggest it's not a good idea in general.
I think it might be kind of moot in the future anyway? When we transition away from rootstock and toward a single manubot executable, it'll be much easier for users to update their version of manubot (and the plugins along with it).
I'll look into whether 3.0.0 breaks the current manubot plugins today.
Ah according to this answer it looks like ajax.googleapis.com does support leaving out the PATCH version in the URLs, but testing that with cdnjs.cloudflare.com, it does not work.
This SO post seems to suggest it's not a good idea in general.
Yeah, although they're talking about using the latest MINOR and even MAJOR version. If MathJax follows proper semantic versioning, then they shouldn't release backwards incompatible changes in PATCH versions. Anyways, it's pretty minor, we can always update the version ourselves.
I think it might be kind of moot in the future anyway? When we transition away from rootstock and toward a single manubot executable, it'll be much easier for users to update their version of manubot (and the plugins along with it).
Yes hopefully. But we'll still have to update the MathJax version manually in the single manubot executable... which is not necessarily bad and probably only has to be done once a year.
I'll look into whether 3.0.0 breaks the current manubot plugins today.
Awesome. 3.0.1 is out now.
Okay, per here, version 3 doesn't support automatic linebreaking. That means long equations will not auto wrap. Version 3 also changes some of the HTML structure and classnames which breaks some of our CSS for it.
Also, the usage instructions for version 3 show how you can always use the latest version.
As it stands, we should probably wait to upgrade, unless you think there's a big advantage to using 3? Regarding long equations, we can have a scrollbox for it on HTML view (if we change our CSS), but print view will still overflow.
I agree that we should wait until automatic line breaking support is added to version 3. From the link:
Currently, automatic line breaking support is missing from version 3. This is a key feature to be included in a future release.
The overflow in the print view would be a big annoyance, so hopefully they get around to resolving this. We can revisit this issue in several months to see if there's progress.
Also, the usage instructions for version 3 show how you can always use the latest version.
Ah cool. Looks like we could pin to MAJOR.MINOR with PATCH like:
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-mml-chtml.js">
</script>
Not sure if we need polyfill for MathJax-script to work properly.
Not sure if we need polyfill for MathJax-script to work properly.
I'd have to look to see what ES6 features they're using, but most likely we don't need it. Chrome, Firefox, and Safari (the most used browsers and in general the browsers we support) almost always support the latest javascript features, and polyfills are normally used to support Internet Explorer (which we don't support).