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

Remove has_equations from the mathematics domain #13044

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

AA-Turner
Copy link
Member

Feature or Bugfix

  • Performance

Purpose

When profiling, MathDomain.process_doc() takes around 1% of runtime. We can reduce this to ~0.

Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a CHANGELOG entry to indicate that a new context data has been added to the context object for the handler and that a publicly named (yet probably not documented) method has been removed from the domain API.

I have a very bad Internet connection so I don't know if I'll be able to review more.

sphinx/writers/html.py Outdated Show resolved Hide resolved
sphinx/writers/html5.py Outdated Show resolved Hide resolved
@chrisjsewell
Copy link
Member

Heya, you do realise this is used by one of sphinx's own extensions 😅: https://github.com/sphinx-doc/sphinxcontrib-jsmath/blob/19763d7fc9ebb29eb2f325fef0bc6f067907a233/sphinxcontrib/jsmath/__init__.py#L70
it is also used here: https://github.com/jbms/sphinx-immaterial/blob/69e685aedd338f6766ddb5bae9b2189d2e7a6898/sphinx_immaterial/local_mathjax.py#L28

Calling a method internal, just because it is undocumented, is incorrect; if does not start with an _ it is public.

Not saying not to change, but the new means of detection should also be public and documented

@AA-Turner
Copy link
Member Author

Calling a method internal, just because it is undocumented, is incorrect; if does not start with an _ it is public.

Whilst we are now using this philosophy for new code, I don't think it holds true for old code, where marking names as private was less deliberate.

Both cases you cite are effective copies of ext.mathjax, but I will see if there is a means to improve compatability (at the very least, restore MathDomain.has_equations() and always return True).

A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants