是否有可能对主TOCTree隐藏一个(或所有)在RST文件中的子部分?
让我再详细描述一下:
index.rst
:doc:`Label <path/to/rst/file>`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. toctree::
Label <path/to/rst/file>
Label <path/to/rst/file>
Label of Children TOCTree <path/to/rst/children/file>children/file.rst
Children Title
==============
.. toctree::
Label of Grandchildren 1
Label of Grandchildren 2
Subsection 1
------------
Subsection 2
------------
Subsection 3
------------这些文件构建后,将生成主TOCTree:
我想隐藏这些子部分,只保留TOCTrees,尽可能多,越深越好。例如:
但是,如果单击与标签相关的超链接,则按通常的方式列出子部分;
发布于 2016-11-04 15:27:45
我花了一段时间才弄明白,但我想我终于明白了。“诀窍”是,您需要在包含toc的父rst和包含该节的子rst中设置指令。
对我来说,我将:maxdepth:1和:titlesonly:添加到父程序中的toc中,然后将:titlesonly:添加到子表中的toc中,这非常有效。这样,我就可以在子表中有层次化的分段格式,这是正确呈现的,在TOC中没有显示出来。
发布于 2013-08-17 00:11:10
"rubric“指令可以实现您想要的结果:
http://sphinx-doc.org/markup/para.html#directive-rubric
它不会以完全相同的方式生成章节标题,但至少它们不会出现在TOC中。
发布于 2013-08-31 18:28:05
您可以使用maxdepth参数toctree来设置TOC的深度:
.. toctree::
:maxdepth: 2https://stackoverflow.com/questions/15035546
复制相似问题