Expand description
Section and figure numbering: TocTreeCollector.assign_section_numbers
and assign_figure_numbers (sphinx/environment/collectors/toctree.py:197-378),
the two halves of get_updated_docs the resolve phase runs once every
document’s toc is in the environment.
assign_section_numberswalksenv.tocsfrom every:numbered:toctree, fillingenv.toc_secnumbers[docname][anchorname]and stamping asecnumberattribute onto the veryreferencenodessuper::toctree::build_toccreated (plus the document’s title node, so rellinks can show its number).assign_figure_numberswalks the doctrees in document order, following toctrees depth-first, and numbers every enumerable node (figure/table/captioned code-block) intoenv.toc_fignumbers[docname][figtype][id].
Both return the docnames whose numbers differ from the previous
environment — Sphinx’s env-get-updated contribution, which widens the
write set on an incremental build.
NOT here: the numref role’s use of these tables (std domain
resolution) and numfig_format rendering. This module only assigns the
numbers.
Structs§
- Numbering
Warning - One diagnostic from
assign_section_numbers. - Section
Numbering - What
assign_section_numbersproduced.
Functions§
- assign_
figure_ numbers - Assign a figure number to every enumerable node reachable from the root document.
- assign_
section_ numbers - Assign a section number to every heading under a
:numbered:toctree.
Type Aliases§
- Doctree
Loader - How the numbering passes reach a document’s doctree.