sphinx-doc / sphinx-doc/sphinx

Toctree `numbered` option doesn't create <ol> element

Open
#7,934 15 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

builder:html help wanted internals:toctree type:proposal
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
When building HTML, the toctree numbered option doesn't create <ol> element but instead, keeps an <ul> and add a number to the title of the linked pages.

To Reproduce


.. toctree::
   :maxdepth: 1
   :numbered:

   page1.rst
   page2.rst

Gives

<ul>
<li class="toctree-l1"><a href="page1.html">1. My title</a></li>
<li class="toctree-l1"><a href="page2.html">2. My other title</a></li>
</ul>

That also creates styling problems like have a bullet in front of numbers.

Expected behavior

Semantically, wouldn't it be better to get:

<ol>
<li class="toctree-l1"><a href="page1.html">1. My title</a></li>
<li class="toctree-l1"><a href="page2.html">2. My other title</a></li>
</ol>

Environment info

  • OS: macos
  • Python version: 3.7.5
  • Sphinx version: 3.1.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided reStructuredText toctree and inspect the generated HTML. The work is done when a numbered toctree uses an

    element with numbered links and no unwanted bullet styling.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.