Upgrade MathJax support from v2/v3 to v3/v4#7898
Conversation
…cript to reference mathjax v3/v4 instead of v2/v3
…roach, and migrate to v3/v4
…t of render, make sure raw input text is hidden at end of MathJax render, start render chain with Promise.resolve()
656d638 to
9c0b33c
Compare
9c0b33c to
83bb307
Compare
Co-authored-by: Cameron DeCoster <cameron.decoster@gmail.com>
Co-authored-by: Cameron DeCoster <cameron.decoster@gmail.com>
…d larger than 16)
dc176ac to
5b03600
Compare
…ashboard index page for mathjax 4 chtml
camdecoster
left a comment
There was a problem hiding this comment.
It's working for me. Good work!
|
Note: While QAing these changes in Jupyter Notebook (v7), I discovered that the latest Plotly release (plotly.py 6.9.0, plotly.js 3.7.0) does not render MathJax equations in Jupyter. There is an open plotly.py issue plotly/plotly.py#1740 capturing the problem for JupyterLab; I am not sure how long the issue has been present in Jupyter Notebook as well, but possibly since the release of Jupyter Notebook 7. It seems at some point, Jupyter stopped exposing a fully-loaded global All this to say, the changes in this PR also don't work in JupyterLab / Jupyter Notebook; however, since the issue is previously existing, this isn't a regression. We will move ahead with these changes while also investigating how to restore MathJax rendering in Plotly charts in Jupyter. |
Co-authored-by: Mojtaba Samimi <33888540+archmoj@users.noreply.github.com>
Co-authored-by: Mojtaba Samimi <33888540+archmoj@users.noreply.github.com>
|
Thanks @emilykl for the great PR. |
Good catch, I forgot new mocks had to be manually added to the |
351aa83 to
ed00b8d
Compare
Update plotly.js to be compatible with MathJax v4, and drop support for MathJax v2.
Closes #7598.
Due to some logic improvements, this should also make MathJax rendering faster.
src/lib/svg_text_utils.jsto use MathJax v3/v4 syntax to render math symbolsMathJax.startup.defaultReady()on every individual renderMathDocument.convert(tex)rather thanMathJax.typeset(tex)MathJax._.mathjaxnamespace. While not officially documented, the pattern is used in several places (one, two, three) in the MathJax docs for advanced configurationmathjax3__mathjaxmock, the pie labels which were previously hidden, are now visible as raw MathJax. We don't support rendering MathJax in pie labels. Now at least the behavior is consistent between v3 and v4. However we could change the behavior to hide MathJax text strings in places where we don't support rendering MathJax.Steps for testing
npm start) which uses MathJax 4mathjaxin the name (and the other baselines changed here) looks OK and matches the new baselines on this branchmathjaxmock itself contains several strings of TeX which don't render due to us not supporting MathJax in pie labels; this is not new, and it's (somewhat) deliberate, to lock in the fallback behaviorhttp://localhost:3000/devtools/test_dashboard/index-mathjax3.html) and verify again that everything looks fine