jupyter-book
jupyter-book copied to clipboard
TOC rendered from md-files differs from TOC renders from ipynb-files
Describe the bug
context When titles in a jupyter book comprise symbols, the TOC rendered from md-files differs from TOC rendered from ipynb-files
expectation I expected the TOC to be rendered fully independent of the root format of the file being looked as the main text.
bug TOC rendered from ipynb-files show the symbols TOC rendered from md-files show the originating latex
As an example the difference between md and ipynb TOC rendering is shown below.
Markdown
ipynb
Reproduce the bug
- create a JB with some latex symbols in a title of any chapter
- provide a md file and a ipynb file in the TOC
- build the book
List your environment
jupyter-book --version
Jupyter Book : 0.15.1
External ToC : 0.3.1
MyST-Parser : 0.18.1
MyST-NB : 0.17.2
Sphinx Book Theme : 1.0.1
Jupyter-Cache : 0.6.1
NbClient : 0.8.0
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
A hacky fix for this issue with TOC maths rendering from .md source, per comment https://github.com/phockett/Quantum-Metrology-with-Photoelectrons-Vol3/issues/4#issuecomment-1781364854
I (eventually) managed to fix the TOC bug, since I realised it only affected pages which had no maths on - in this case it seems like the Mathjax script wasn't automatically injected.
There's likely an elegant way to force this via Sphinx config, but my quick and dirty fix was just to add a cell directly to my Markdown documents duplicating the script tags in the working HTML pages - my patch is in https://github.com/phockett/Quantum-Metrology-with-Photoelectrons-Vol3/blob/main/scripts/mathjax_patch.txt (and my in my main build script I just run
cat mathjax_patch.txt >> page.mdfor each page I need to add the script to).