[ENH/FIX] Support headings in nested parse by minijackson · Pull Request #1102 · executablebooks/MyST-Parser

added 2 commits

February 4, 2026 20:34
This fixes using Markdown headings in Sphinx objects,
like the `object`, `describe`, `py:data` directives, etc.

This works by adding the heading to the temp root parent
instead of at the end of the previous section from the main document.

Fixes executablebooks#1050
This makes it so nested headings (in blockquotes, admonitions, etc.)
generates rubrics that are offset by the current heading level,
meaning that:

```markdown
# Title
## Sub-title
> Quote:
> # Title in quote
> Content.
```

will generate a rubric level 3 (level 1 + offset by 2 by the "Sub-title")
inside the blockquote.

This also makes those rubrics support the Sphinx option `heading-level`,
for properly generating `<h1>`, `<h2>`, etc.

A fix in the documentation was necessary, as an example generated a
level-4 heading, whose id wasn't generated
due to a myst_heading_anchors value too low.