6

我有一个 Sphinx 主文档,其中包括如下子文档:

.. toctree::
    :maxdepth: 2
    :numbered:

    doc1
    doc2
    doc3
    doc4
    doc5
    doc6 

我想将 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>

我目前的方法是创建伪子文档,列出其 TOC 中的实际文档,例如,“part1.rst”将具有:

.. toctree::
    :maxdepth: 2
    :numbered:

    doc1
    doc2

然后在主文档中:

.. toctree::
    :maxdepth: 3
    :numbered:

    part1
    part2
    part3

这样做的问题是,当单击“part1”的链接时,您会被带到一个没有实际内容的页面(“part1.rst”)。

还有其他方法吗?

或者,有没有办法禁止“part1.rst”的条目生成页面链接?

4

1 回答 1

4

一种选择是这样做:

.. toctree::
    :maxdepth: 2
    :numbered:

    doc1
    doc2
    doc3

Subheading
-----------

.. toctree::
    :maxdepth: 2
    :numbered:

    doc4
    doc5
    doc6 
于 2014-08-02T01:40:31.097 回答