Describe the bug
When a named admonition (.. danger::, .. warning::, ...) is nested inside a .. todo:: directive, and the source document is written before a document containing .. todolist::, the admonition appears with two title bars on the todolist page, while the source page renders it correctly with one:
Source: https://kdeldycke.github.io/click-extra/todolist.html
The duplication depends on alphabetical document order: if the todolist page is written first, both pages render correctly.
How to Reproduce
Minimal project, three files, sphinx.ext.todo as the only extension (reproduced on Sphinx 9.1.0).
conf.py:
project = "repro"
extensions = ["sphinx.ext.todo"]
todo_include_todos = True
index.rst:
Index
=====
.. toctree::
a
b
a.rst (document holding the todo, written first alphabetically):
Doc A
=====
.. todo::
A todo entry.
.. danger::
Danger inside a todo.
b.rst (the todolist page, written second):
Doc B
=====
.. todolist::
Build with sphinx-build -b html . _build.
Actual: a.html contains one <p class="admonition-title">Danger</p>; b.html contains two.
Expected: exactly one title on both pages, independent of document ordering.
Swapping the names so the todolist page sorts first (todo page becomes z.rst) makes both pages render a single title, which shows the bug is order-dependent.
Environment Information
- Sphinx 9.1.0
- Python 3.14, macOS
- HTML builder, Alabaster and Furo themes
Sphinx extensions
extensions = ["sphinx.ext.todo"]
Additional context
No response
Describe the bug
When a named admonition (
.. danger::,.. warning::, ...) is nested inside a.. todo::directive, and the source document is written before a document containing.. todolist::, the admonition appears with two title bars on the todolist page, while the source page renders it correctly with one:Source: https://kdeldycke.github.io/click-extra/todolist.html
The duplication depends on alphabetical document order: if the todolist page is written first, both pages render correctly.
How to Reproduce
Minimal project, three files,
sphinx.ext.todoas the only extension (reproduced on Sphinx 9.1.0).conf.py:index.rst:a.rst(document holding the todo, written first alphabetically):b.rst(the todolist page, written second):Build with
sphinx-build -b html . _build.Actual:
a.htmlcontains one<p class="admonition-title">Danger</p>;b.htmlcontains two.Expected: exactly one title on both pages, independent of document ordering.
Swapping the names so the todolist page sorts first (todo page becomes
z.rst) makes both pages render a single title, which shows the bug is order-dependent.Environment Information
Sphinx extensions
Additional context
No response