Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to choose mathjax load method #9864

Closed
raphaeltimbo opened this issue Nov 18, 2021 · 0 comments
Closed

Add option to choose mathjax load method #9864

raphaeltimbo opened this issue Nov 18, 2021 · 0 comments

Comments

@raphaeltimbo
Copy link

Is your feature request related to a problem? Please describe.

Plotly uses mathjax v2, so to render graphs using this package we have to make sphinx also use mathjax v2 with (see #9563):

mathjax_path = (
    "https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
)

The problem in Sphinx 4.3 is that now, as discussed in #9450, mathjax is loaded with the “defer” option instead of “async”, and this breaks plotly rendering.

Describe the solution you'd like
In the mathjax2_config dict, it would be nice to have an option "load_method" in which we would be able to choose "async" or "defer"

Additional context
Error that shows up in the console:
image

image

@raphaeltimbo raphaeltimbo added the type:enhancement enhance or introduce a new feature label Nov 18, 2021
@tk0miya tk0miya added type:bug extensions markup and removed type:enhancement enhance or introduce a new feature labels Nov 18, 2021
@tk0miya tk0miya added this to the 4.3.1 milestone Nov 18, 2021
tk0miya added a commit to tk0miya/sphinx that referenced this issue Nov 18, 2021
MathJax library has been loaded via "defer" strategy since v4.3.0.  But
it prevents to work MathJax v2.  This rollbacks the change and use
"async" strategy as default again.

To support changing "defer" strategy, this introduces a new confval;
mathjax_loading_method to switch the loading method of MathJax.
tk0miya added a commit to tk0miya/sphinx that referenced this issue Nov 18, 2021
MathJax library has been loaded via "defer" strategy since v4.3.0.  But
it prevents to work MathJax v2.  This rollbacks the change and use
"async" strategy as default again.

To support changing "defer" strategy, this introduces a new confval;
mathjax_loading_method to switch the loading method of MathJax.
tk0miya added a commit to tk0miya/sphinx that referenced this issue Nov 21, 2021
MathJax library has been loaded via "defer" method since v4.3.0.  But
it prevents to work MathJax v2.  This rollbacks the change and use
"async" method as default again.

To support changing the loading method, this allows to specify it via
mathjax_options.
tk0miya added a commit that referenced this issue Nov 23, 2021
Fix #9864: mathjax: Failed to render equations via MathJax v2
@tk0miya tk0miya closed this as completed Nov 23, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants