Skip to content

🐛 fix(toctree): use section node when title is empty#291

Merged
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:fix-empty-title-toctree
Mar 2, 2026
Merged

🐛 fix(toctree): use section node when title is empty#291
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:fix-empty-title-toctree

Conversation

@gaborbernat
Copy link
Member

@gaborbernat gaborbernat commented Mar 2, 2026

When :title: is set to empty to suppress the auto-generated heading, the directive used a paragraph node as the root container. This broke toctree detection — child group headings like "positional arguments" and "options" were rendered as <h2> in the HTML but weren't discoverable by Sphinx's toctree because they weren't nested inside a proper section hierarchy. 🐛

The fix switches the empty-title container from paragraph() to section(""), preserving the document structure that toctree relies on while still suppressing the visible heading. This matches the behavior users expect when they provide their own document title via RST and use :title: to avoid a duplicate.

Fixes #48

@gaborbernat gaborbernat added the bug Something isn't working label Mar 2, 2026
When :title: was set to empty, a paragraph node was used as the
container instead of a section. Child group headings weren't recognized
by toctree since they weren't inside a proper section hierarchy.

Fixes tox-dev#48
@gaborbernat gaborbernat force-pushed the fix-empty-title-toctree branch from 9d7070e to b643d7b Compare March 2, 2026 04:09
@gaborbernat gaborbernat merged commit 2e8609c into tox-dev:main Mar 2, 2026
9 checks passed
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

Successfully merging this pull request may close these issues.

When title is empty, argument groups are not recognized by toctree

1 participant