Add --math-output=MathJax for rst2html #7763
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.