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

Do not include MathJax.js unless it is really needed #5497

Closed
mitya57 opened this issue Sep 27, 2018 · 7 comments
Closed

Do not include MathJax.js unless it is really needed #5497

mitya57 opened this issue Sep 27, 2018 · 7 comments
Labels
Milestone

Comments

@mitya57
Copy link
Contributor

mitya57 commented Sep 27, 2018

When a project does not have any math directives or roles, still every HTML page has this tag when built with Sphinx 1.8:

<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

This is unwanted, and did not happen with Sphinx 1.7.

It would be nice if the tag was included only when the page (or the project as a whole) has a math directive or role.

@tk0miya tk0miya added the type:proposal a feature suggestion label Sep 29, 2018
@tk0miya tk0miya added this to the 1.8.2 milestone Sep 29, 2018
@tk0miya
Copy link
Member

tk0miya commented Sep 29, 2018

+1; reasonable.

tk0miya added a commit to tk0miya/sphinx that referenced this issue Oct 15, 2018
tk0miya added a commit to tk0miya/sphinx that referenced this issue Oct 16, 2018
tk0miya added a commit to tk0miya/sphinx that referenced this issue Oct 16, 2018
tk0miya added a commit that referenced this issue Oct 25, 2018
…eded

Fix #5497: Do not include MathJax.js and jsmath.js unless it is really needed
@tk0miya
Copy link
Member

tk0miya commented Oct 25, 2018

Fixed by #5536
Thank you for reporting!

@tk0miya tk0miya closed this as completed Oct 25, 2018
@mitya57
Copy link
Contributor Author

mitya57 commented Oct 25, 2018

Wow, thanks a lot!

@jabl
Copy link

jabl commented Mar 28, 2019

Would it be possible to only include the mathjax js script on a per-page basis? While #5536 is an improvement, it still seems that even if only one page in the build contains math, mathjax is included in every page.

In our case, we have 1 page that needs math, and 167 that don't. And mathjax is huuuuge..

@tk0miya
Copy link
Member

tk0miya commented Mar 29, 2019

@jabl That is not easy, but maybe possible. Could you file a new issue please? I'll try it in future version.

@NateZimmer
Copy link

Something about this does not operate well. I clearly got math in my docs but randomly mathjax isn't included. This seems to occur when I update the conf.py but I don't edit the .rst files. When I edit a .rst file it fixes itself.

@tk0miya
Copy link
Member

tk0miya commented Mar 30, 2019

@NateZimmer I guess it might be a bug of incremental build. Could you file an issue with detailed procedure please? I'll take a look later.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants