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: display math characters in the header navbar #971

Merged
merged 5 commits into from Oct 6, 2022

Conversation

12rambau
Copy link
Collaborator

@12rambau 12rambau commented Oct 4, 2022

Fix #226
In the header toctree function I rewrote the content of the title using a span if a math node is included.

to be interpreted inline math needs to be in ["(", ")"] characters (and compatible with mathJax of course).

Worked on my test documentation with "About :math:\alpha":

Capture d’écran 2022-10-04 à 13 04 30

@12rambau 12rambau marked this pull request as ready for review October 4, 2022 11:05
Copy link
Collaborator

@choldgraf choldgraf left a comment

Choose a reason for hiding this comment

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

Just a quick comment to clarify what the function does and when it is meant to be used. Did I get that correct? Other than this it seems good to me!

So this is only applied to the table of contents, not to the in-page header (which I guess has math displayed properly)

src/pydata_sphinx_theme/__init__.py Outdated Show resolved Hide resolved
Co-authored-by: Chris Holdgraf <choldgraf@gmail.com>
@12rambau
Copy link
Collaborator Author

12rambau commented Oct 4, 2022

So this is only applied to the table of contents, not to the in-page header (which I guess has math displayed properly)

from what I understand, matJax is simply looking for \( and \) to replace it by inline math. in the other sidebars, we use the node itself so it works but in the header we wrote down the HTML from the tilte so we only get the text (avoiding the processing of the docutils node).

I noticed other places where mathJax is actually not running as expected (prev-next button, toctree in articles) but as it's not working with sphinx default theme that's not for us.

PS: waiting for 0.11 to be released before merging

@12rambau 12rambau merged commit 4fb84f8 into pydata:main Oct 6, 2022
@12rambau 12rambau deleted the math branch October 6, 2022 12:30
@jarrodmillman jarrodmillman added this to the 0.12 milestone Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Math characters aren't rendered in sidebars
3 participants