sphinx-doc / sphinx-doc/sphinx
Add <span class="section-number"> to section numbers in "globaltoc.html"
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem? Please describe.
It's not really a problem, but I (as a theme author) would like to style the section numbers in the sidebar separately from the section titles.
In other places, the section numbers are already enclosed in <span class="section-number"> and </span>, so I think it would make sense to also have this in the globaltoc.html (in the sidebar).
Describe the solution you'd like
I'd like the function toctree() (which is available inside the HTML templates) to add <span class="section-number"> and </span> around section numbers.
Describe alternatives you've considered
I guess an alternative would be to re-implement the whole toctree() function, but I think this would be a lot of work and I wouldn't even know where to start.
I think with the current version of the toctree() function it is not possible to select the section numbers with CSS.
Additional context
This would be the logical continuation of:
- #6613
- #6632
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 with the globaltoc.html template and trace the toctree() function exposed to HTML templates. Compare the related changes in issues #6613 and #6632, then verify that section numbers in the generated sidebar output are enclosed in the requested span while section titles remain separately styleable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, python
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100