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

Mathjax not working with singlehtml #11483

Closed
spaceChRiS opened this issue Jul 7, 2023 · 2 comments · Fixed by #11597
Closed

Mathjax not working with singlehtml #11483

spaceChRiS opened this issue Jul 7, 2023 · 2 comments · Fixed by #11597

Comments

@spaceChRiS
Copy link

Describe the bug

This is probably related to #9686.

When using the mathjax extension, math is working in the html output but not in the singlehtml output.

Manually adding the line

<script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>

which is missing in the singlehtml output but present in the html output makes math work well.

How to Reproduce

Run sphinx with mathjax extension on a documentation containing some math with the singlehtml target. The actual test case that was used uses markdown files and math is not present in the main rst file but in one of the later included files (in case that makes a difference, which may be the case reading #9686).

Environment Information

This is running in a linux CI environment. I can reproduce it locally with sphinx 7.0.1.

Sphinx extensions

myst_parser, sphinx_math_dollar, sphinx.ext.mathjax

Additional context

No response

@picnixz
Copy link
Member

picnixz commented Jul 13, 2023

You can do the following trick in conf.py:

def setup(app):
    app.set_html_assets_policy('always')

@spaceChRiS
Copy link
Author

This works for me, thank you very much!

@AA-Turner AA-Turner added this to the some future version milestone Aug 11, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants