好的,我正在使用Sphinx Autosummary为一些类生成文档。有三种不同类型的类,我希望我的侧边栏有三个不同的部分,就像我在toctree指令中使用:caption:选项一样。
因此,我添加了将autosummary指令分隔为三个较小的指令,并在它们之间放置一个隐藏的toctree,如下所示:
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之类的东西。我只想要字幕。我该怎么做呢?
发布于 2019-12-15 18:36:13
toctree的目的是组织嵌套页面,它应该至少有一个条目(文件名)。否则,使用它就没有任何意义了。
下面的标记使用sphinx_rtd_theme生成所需的侧边栏。我知道它不能给你你想要的索引页,但我想不出其他的方法。将autosummary指令放在单独的文件中,并将每个文件作为toctree条目添加。
.. toctree::
:caption: Section 1
autosummary1
.. toctree::
:caption: Section 2
autosummary2https://stackoverflow.com/questions/59327002
复制相似问题