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

⬆️ UPGRADE: sphinx v4 (& drop sphinx v2, change mathjax override) #390

Merged
merged 4 commits into from
Jun 12, 2021

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented Jun 11, 2021

The main change is with mathjax. It's still a bit of a faff, but I think the approach is a little better:
tex2jax_process and mathjax_process classes are added to the top-level sections of myst documents (this "fixes" having to override setting for RST documents), this tells mathjax not to render for any math under this section (i.e. the entire document) by default. The math class is then added to the process list, which overrides the default, and so tells mathjax to render elements (and child elements) with this class.
So basically it constricts mathjax to only rendering the elements we want.
This is also explained at; https://myst-parser--390.org.readthedocs.build/en/390/using/syntax.html#mathjax-and-math-parsing

As well as this, most of the sphinx test regression files have been split into sphinx3 (docutils<0.17) and sphinx4 (docutil 0.17) variants.

closes #378

@codecov
Copy link

codecov bot commented Jun 11, 2021

Codecov Report

Merging #390 (df1edfa) into master (5f37c0b) will decrease coverage by 0.15%.
The diff coverage is 75.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #390      +/-   ##
==========================================
- Coverage   90.54%   90.39%   -0.16%     
==========================================
  Files          14       14              
  Lines        1830     1843      +13     
==========================================
+ Hits         1657     1666       +9     
- Misses        173      177       +4     
Flag Coverage Δ
pytests 90.39% <75.75%> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
myst_parser/mathjax.py 80.48% <50.00%> (-16.39%) ⬇️
myst_parser/main.py 87.50% <80.00%> (-0.44%) ⬇️
myst_parser/docutils_renderer.py 93.17% <100.00%> (+0.65%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f37c0b...df1edfa. Read the comment docs.

@mmcky
Copy link
Member

mmcky commented Jun 11, 2021

🥳 -- thanks @chrisjsewell. Will do some testing. What's your timeframe for feedback (i.e. when do you want to merge this?)

@chrisjsewell
Copy link
Member Author

Well ASAP I guess for those waiting on it, can you look in the next day or 2?
Also @choldgraf?

choldgraf
choldgraf previously approved these changes Jun 11, 2021
Copy link
Member

@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.

This looks great to me, just one minor under-the-hood thought but it's no biggie. Exciting to see support for v4!

Also I believe this will close #378 so added that to the top comment

myst_parser/mathjax.py Show resolved Hide resolved
@chrisjsewell
Copy link
Member Author

Also I believe this will close #378 so added that to the top comment

FYI this was already in the linked issues. In case you didn't know adding in the initial comment is only useful when you first create the PR; to auto-add to the linked issues, after that it doesn't do anything

@chrisjsewell chrisjsewell changed the title ⬆️ UPGRADE: sphinx v4 (and drop sphinx v2) ⬆️ UPGRADE: sphinx v4 (& drop sphinx v2, change mathjax override) Jun 12, 2021
@chrisjsewell chrisjsewell merged commit 340e719 into master Jun 12, 2021
@chrisjsewell chrisjsewell deleted the sphinx4 branch June 12, 2021 22:41
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.

Sphinx 4.0 Support (including Mathjax 3) mathjax_config ignored
3 participants