【发布时间】:2020-04-07 04:01:58
【问题描述】:
好的,我正在使用 Sphinx Autosummary 为某些类生成文档。有三种不同类型的类,我希望我的侧边栏有三个不同的部分,就像我在 toctree 指令中使用 :caption: 选项一样。
所以我添加了将我的自动摘要指令分成三个较小的指令,并在它们之间放置了一个隐藏的目录树,如下所示:
Section 1
.. toctree::
:hidden:
:caption: Section 1
.. autosummary
:toctree: stubs
myclass
anotherclass
Section 2
.. toctree::
:hidden:
:caption: Section 2
.. autosummary::
:toctree:
thirdclass
产生一个侧边栏,如:
myclass
anotherclass
thirdclass
这不起作用。我的 index.html 的层次结构正是我想要的样子,但是侧边栏缺少我的标题,它们没有显示出来。当我在这些隐藏的目录树下添加类似self 的页面时,会显示标题:
Section 1
.. toctree::
:hidden:
:caption: Section 1
self
.. autosummary
:toctree: stubs
myclass
anotherclass
Section 2
.. toctree::
:hidden:
:caption: Section 2
.. autosummary::
:toctree:
thirdclass
产生一个侧边栏,如:
SECTION 1 (caption)
Documentation Home
myclass
anotherclass
thirdclass
这是我一直在寻找的,但我不想引用 self 或其他任何内容。我只想要字幕。我该怎么做?
【问题讨论】:
-
你在使用 sphinx_rtd_theme 吗?
-
是的,我正在使用那个主题。
标签: python python-sphinx restructuredtext toctree