Markdown with `=` line in LaTeX block breaks TOC and syntax highlighting
Author: c4rloCreated Sep 25, 2026Updated Sep 28, 2026
Labelsbugstatus:Needs Triage
Description
When a Markdown file or cell has a $$-delimited LaTeX block with a line containing only =, such as:
$$
\text{This}
=
\text{broken.}
$$The line above the = gets misinterpreted as a Markdown heading (the spec calls it a setext heading), despite being inside the LaTeX block.
This happens in two separate places, causing two distinct issues, both shown in the below screenshot:
Issues:
- The Table of Contents shows a bogus
$$ \text{This}heading. - The editor messes up the highlighting in that LaTeX block.
Reproduce
- Create a Markdown file with content as above.
- Open Table of Contents.
- Notice a heading called
$$ \text{This}shows up in the TOC. - Notice bad syntax highlighting in the editor.
Variations of this bug
- Markdown inside notebook instead of Markdown file: same issue occurs.
- More than one
=, or-instead of=: same issue occurs, representing different ways of creating a "setext" heading.
Expected behavior
$$ \text{This}does not show up in the TOC.- Editor correctly highlights LaTeX block.
Source: jupyterlab/jupyterlab