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

Add --math-output=MathJax for rst2html #7763

Closed
wants to merge 0 commits into from

Conversation

sumnerevans
Copy link

@sumnerevans sumnerevans commented Oct 2, 2020

Closes: #5349
Closes: #7759

Supersedes and Closes: #5350

There are two changes in this PR:

  • As noted in reStructuredText uses long token names for syntax highlighting #5349, rst2html can generate HTML with short or long form class names for syntax highlighting. Pygments (via the pygmentize command) seems to generate short form by default without any way to switch this. This means most/any stylesheets for code provided with various themes won't work when using rST output. This can easily be fixed by providing the --syntax-highlight=short flag to rst2html.

  • As noted in Math in reStructuredText isn't formatted with MathJax #7759, rst2html exports math using the "HTML math.css" formatter by default. This means that any math typeset in reStructuredText is not formatted using MathJax which is not ideal. This commit adds a --math-output parameter configure rst2html to output math ready for MathJax to process. Note that I had to pick a URL for MathJax, but it doesn't end up in the resulting output because the <script> tag is in the header which gets cut out by code further down.

I have added tests to verify that each of the above fixes are working. I also had to add a step to install pygments to make the test work.

@sumnerevans
Copy link
Author

I think this is finally ready for review. I've gone through the CONTRIBUTING document and I believe that I've followed all of the guidelines. I also added tests to verify the functionality is correct. Please let me know what else I need to do to get this merged.

@anthonyfok anthonyfok removed their assignment Jan 8, 2024
Copy link

github-actions bot commented Jan 8, 2025

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants