【发布时间】:2013-02-23 00:32:34
【问题描述】:
是否可以从主 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:
- 标签
- 标签
- 儿童标签
- 孙子标签 1
- 孙子标签 2
- 第 1 小节
- 第 2 小节
- 第 3 小节
而且我想隐藏子部分,只保留 TOCTrees,尽可能多和尽可能深。例如:
- 标签
- 标签
- 儿童标签
- 孙子标签 1
- 孙子标签 2
但是,如果点击了与儿童标签相关的超链接,则子部分将照常列出;
【问题讨论】:
-
也许
titlesonly选项是您正在寻找的。见sphinx-doc.org/markup/toctree.html。 -
我试过了,但它与我想要的完全相反,保留标题并隐藏孩子的 TOCTrees。
标签: python-sphinx sections toctree