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

TOC rendered from md-files differs from TOC renders from ipynb-files #2043

Open
jangenoe opened this issue Aug 1, 2023 · 2 comments
Open
Labels
bug Something isn't working

Comments

@jangenoe
Copy link

jangenoe commented Aug 1, 2023

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

markdown rendering

ipynb

ipynb rendering

Reproduce the bug

  1. create a JB with some latex symbols in a title of any chapter
  2. provide a md file and a ipynb file in the TOC
  3. 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
@jangenoe jangenoe added the bug Something isn't working label Aug 1, 2023
@welcome
Copy link

welcome bot commented Aug 1, 2023

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

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! 🎉

@phockett
Copy link

A hacky fix for this issue with TOC maths rendering from .md source, per comment phockett/Quantum-Metrology-with-Photoelectrons-Vol3#4 (comment)

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.md for each page I need to add the script to).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants