Skip to content

docs: render math in Jupyter notebooks (MathJax $ delimiters) - #9

Merged
thisiscam merged 1 commit into
mainfrom
fix-notebook-mathjax
May 25, 2026
Merged

thisiscam merged 1 commit into
mainfrom
fix-notebook-mathjax

Conversation

@thisiscam

Copy link
Copy Markdown
Owner

Notebook markdown math ($\varphi(t)$ etc.) was showing as literal text: the MathJax config only processed arithmatex spans (\(...\), from the .md pages), but mkdocs-jupyter emits notebook math as raw $...$.

Fix: accept both delimiter styles and let MathJax scan the whole page (it skips <pre>/<code>, so $ in code cells is untouched). Verified: mkdocs build --strict clean; notebook pages now carry the $ math + load MathJax; the .md API page's arithmatex spans (\(...\)) still render under the same config.

The MathJax config only processed pymdownx.arithmatex spans (\(...\) on .md
pages). mkdocs-jupyter emits notebook markdown math as raw $...$, which was
neither delimited nor allowed to be processed, so it showed as literal text.

Accept both delimiter styles (\(...\)/\[...\] for arithmatex, $...$/$$...$$
for notebooks) and drop the arithmatex-only processHtmlClass restriction so
MathJax scans the whole page (it still skips <pre>/<code>, so $ in code is
untouched). Both .md and notebook math now render.
@thisiscam
thisiscam merged commit 55dcd2e into main May 25, 2026
2 checks passed
@thisiscam
thisiscam deleted the fix-notebook-mathjax branch May 25, 2026 02:35
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.

1 participant