sphinx-doc / sphinx-doc/sphinx
Hidden toctree still generates a toctree-wrapper div in output html
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Currently, sphinx generates a <div class="toctree-wrapper compound"> </div> even when toctree is :hidden:.
I think it'd be more consistent if nothing was added to the DOM when toctree is hidden.
My guess is that it boils down to changing this part of the code
https://github.com/sphinx-doc/sphinx/blob/f38bd8e9529d50e5cceffe3ca55be4b758529ff7/sphinx/directives/other.py#L79-L85
and maybe only run ret.append(wrappernode) when subnode['hidden'] is not False?
Let me know what you think!
How to Reproduce
$ git clone https://github.com/.../some_project
$ cd some_project
$ pip install -r requirements.txt
$ cd docs
$ make html SPHINXOPTS="-D language=de"
$ # open _build/html/index and see bla bla
Expected behavior
No response
Your project
https://github.com/nilearn/nilearn
Screenshots
No response
OS
Ubuntu
Python version
3.9
Sphinx version
4.3.2
Sphinx extensions
No response
Extra tools
No response
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in sphinx/directives/other.py at the linked code around lines 79-85 and inspect how hidden toctrees create the wrapper node. Reproduce the issue with a hidden toctree in the documentation build, then verify that the generated HTML contains no toctree-wrapper div for it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100