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

Fix #9864: mathjax: Failed to render equations via MathJax v2 #9867

Merged
merged 4 commits into from Nov 23, 2021

Conversation

tk0miya
Copy link
Member

@tk0miya tk0miya commented Nov 18, 2021

Feature or Bugfix

  • Feature
  • Bugfix

Purpose

  • 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.
  • refs: Add option to choose mathjax load method #9864

@tk0miya tk0miya added type:bug type:enhancement enhance or introduce a new feature markup extensions labels Nov 18, 2021
@tk0miya tk0miya added this to the 4.3.1 milestone Nov 18, 2021
@mgeier
Copy link
Contributor

mgeier commented Nov 18, 2021

Is it really necessary to add a new config value for this?

What about allowing users to specify

mathjax_options = {'async': 'async'}

?

The logic in the implementation would have to change like this: add 'defer': 'defer' to the options, but only if they don't already contain 'async': 'async'. That seems straightforward to me, or am I missing something?

@mgeier
Copy link
Contributor

mgeier commented Nov 18, 2021

It's probably better to check if the config_options contain either of the keys 'async' or 'defer', and only add 'defer': 'defer' if none of those keys is available (regardless of their values).

@tk0miya
Copy link
Member Author

tk0miya commented Nov 21, 2021

It's a good idea.

It's probably better to check if the config_options contain either of the keys 'async' or 'defer', and only add 'defer': 'defer' if none of those keys is available (regardless of their values).

My thought is the default setting should be "async" during v4.x to keep compatibility.

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.
sphinx/ext/mathjax.py Outdated Show resolved Hide resolved
@tk0miya tk0miya merged commit 538e281 into sphinx-doc:4.3.x Nov 23, 2021
@tk0miya tk0miya deleted the 9864_mathjax_loading_method branch November 23, 2021 04:17
@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.
Labels
extensions markup type:bug type:enhancement enhance or introduce a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants