sphinx-doc / sphinx-doc/sphinx

Change starting number for toctree :numbered: option

Open
#8,128 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

internals:toctree type:enhancement
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.
I'm trying to create a table of contents, split into two parts, like so:

.. toctree::
   :maxdepth: 2
   :numbered:
   :caption: Part 1

   chapter-1
   chapter-2

.. toctree::
   :maxdepth: 2
   :numbered:
   :caption: Part 2

   chapter-3
   chapter-4

What I get is:
image
What I'd like is:
image

Describe the solution you'd like
Either the ability to continue numbering from other toctrees, or (probably easier and would work just fine) the ability to set a flag e.g.

.. toctree::
   :maxdepth: 2
   :numbered:
   :caption: Part 2
   :start-from: 3

   chapter-3
   chapter-4

Describe alternatives you've considered
moving the two toctrees into one toctree, or typing the numbering manually

Additional context
NIL

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

Start by locating the implementation and tests for the toctree directive's :numbered: option; no specific files or tests are named in the issue. Compare the two example layouts and determine how a second toctree could begin at a requested number, then add coverage showing the expected numbering for Part 2.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.