Jee*_*eet 6 restructuredtext python-sphinx toctree
我有一个 Sphinx 主文档,其中包含如下子文档:
.. toctree::
:maxdepth: 2
:numbered:
doc1
doc2
doc3
doc4
doc5
doc6
Run Code Online (Sandbox Code Playgroud)
我想将 TOC 分成部分或小节,以便它按照以下方式呈现:
Part 1: Title of Part 1
<doc1 TOC>
<doc2 TOC>
Part 2: Title of Part 2
<doc3 TOC>
<doc4 TOC>
Part 3: Title of Part 3
<doc5 TOC>
<doc6 TOC>
Run Code Online (Sandbox Code Playgroud)
我目前的方法是创建伪子文档,在其目录中列出实际文档,例如,“part1.rst”将具有:
.. toctree::
:maxdepth: 2
:numbered:
doc1
doc2
Run Code Online (Sandbox Code Playgroud)
然后在主文档中:
.. toctree::
:maxdepth: 3
:numbered:
part1
part2
part3
Run Code Online (Sandbox Code Playgroud)
问题在于,当单击“part1”的链接时,您会被带到一个没有实际内容的页面(“part1.rst”)。
还有其他方法吗?
或者,有没有办法抑制“part1.rst”的条目生成页面链接?
一种选择是这样做:
.. toctree::
:maxdepth: 2
:numbered:
doc1
doc2
doc3
Subheading
-----------
.. toctree::
:maxdepth: 2
:numbered:
doc4
doc5
doc6
Run Code Online (Sandbox Code Playgroud)