-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
allow mathjax3_config to point to a JS file #14025
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
base: master
Are you sure you want to change the base?
allow mathjax3_config to point to a JS file #14025
Conversation
| if not config_filepath.exists(): | ||
| msg = f'mathjax3_config file not found: {config_filepath!s}' | ||
| raise ExtensionError(msg) | ||
| if not config_filepath.is_file() or config_filepath.suffix != '.js': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there other extension than .js to consider? I am not familiar with javascript
| @pytest.mark.sphinx( | ||
| 'html', | ||
| testroot='ext-math', | ||
| confoverrides={ | ||
| 'extensions': ['sphinx.ext.mathjax'], | ||
| 'mathjax3_config': '_static/custom_mathjax_config.js', | ||
| }, | ||
| ) | ||
| def test_mathjax3_js_config(app: SphinxTestApp) -> None: | ||
| app.build(force_all=True) | ||
|
|
||
| content = (app.outdir / 'index.html').read_text(encoding='utf8') | ||
| assert MATHJAX_URL in content | ||
| assert '<script defer="defer" src="%s">' % MATHJAX_URL in content | ||
| assert '<script>window.MathJax = {"extensions": ["tex2jax.js"]}</script>' in content | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just duplicated the test above and moved the config to _static/custom_mathjax_config.js.
Fixes #14023
Note: git was telling me that these two files were modified, I'm not sure what's going on: