Skip to content

Commit 06dd99e

Browse files
committed
Expand the markup chapter a bit.
1 parent 0f0c918 commit 06dd99e

10 files changed

Lines changed: 896 additions & 838 deletions

File tree

‎doc/concepts.rst‎

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,58 @@
1+
.. highlight:: rest
2+
13
.. _concepts:
24

35
Sphinx concepts
46
===============
57

8+
Document names
9+
--------------
10+
11+
12+
613

714
The TOC tree
815
------------
916

17+
Since reST does not have facilities to interconnect several documents, or split
18+
documents into multiple output files, Sphinx uses a custom directive to add
19+
relations between the single files the documentation is made of, as well as
20+
tables of contents. The ``toctree`` directive is the central element.
1021

11-
Document names
12-
--------------
22+
.. directive:: toctree
23+
24+
This directive inserts a "TOC tree" at the current location, using the
25+
individual TOCs (including "sub-TOC trees") of the files given in the
26+
directive body. A numeric ``maxdepth`` option may be given to indicate the
27+
depth of the tree; by default, all levels are included.
28+
29+
Consider this example (taken from the Python docs' library reference index)::
30+
31+
.. toctree::
32+
:maxdepth: 2
33+
34+
intro.rst
35+
strings.rst
36+
datatypes.rst
37+
numeric.rst
38+
(many more files listed here)
39+
40+
This accomplishes two things:
41+
42+
* Tables of contents from all those files are inserted, with a maximum depth
43+
of two, that means one nested heading. ``toctree`` directives in those
44+
files are also taken into account.
45+
* Sphinx knows that the relative order of the files ``intro.rst``,
46+
``strings.rst`` and so forth, and it knows that they are children of the
47+
shown file, the library index. From this information it generates "next
48+
chapter", "previous chapter" and "parent chapter" links.
1349

50+
In the end, all files included in the build process must occur in one
51+
``toctree`` directive; Sphinx will emit a warning if it finds a file that is
52+
not included, because that means that this file will not be reachable through
53+
standard navigation. Use :confval:`unused_documents` to explicitly exclude
54+
documents from this check.
1455

56+
The "master file" (selected by :confval:`master_file`) is the "root" of the
57+
TOC tree hierarchy. It can be used as the documentation's main page, or as a
58+
"full table of contents" if you don't give a ``maxdepth`` option.

‎doc/contents.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Sphinx documentation contents
99
intro.rst
1010
concepts.rst
1111
rest.rst
12-
markup.rst
12+
markup/index.rst
1313
builders.rst
1414
config.rst
1515
templating.rst

‎doc/glossary.rst‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ Glossary
2020
documentation root
2121
The directory which contains the documentation's :file:`conf.py` file and
2222
is therefore seen as one Sphinx project.
23+
24+
environment
25+
A structure where information about all documents under the root is saved,
26+
and used for cross-referencing. The environment is pickled after the
27+
parsing stage, so that successive runs only need to read and parse new and
28+
changed documents.

0 commit comments

Comments
 (0)