我想知道是否有一种方法可以扩展包含在标题下的所有小节index.rst
file?
举个例子,它是这样的:
Section 1
Section 2
Section 3
这就是我希望的样子:
Section 1
Subsection 1.1
Subsection 1.2
Subsection 1.3
Section 2
Subsection 2.1
Subsection 2.2
Subsection 2.3
Section 3
Subsection 3.1
Subsection 3.2
Subsection 3.3
如果我单击第 1 部分,它会显示该部分下面的内容,但如果我单击第 2 部分,则第 1 部分的内容将被隐藏,仅显示第 2 部分。我希望每次在索引页上时都能展开所有 2 个部分。我尝试过添加toctree
and maxdepth
,没有任何效果。
好吧,我在尝试读取 sphinx 源代码时丢失了大约 340 万个神经元(它是由一群疯狂鲁莽的浣熊编写的吗?!如此多的抽象层次)。
So :
- 制作你自己的狮身人面像主题(使用第 3 方主题作为基础,非常简单。我为此使用“可读”主题)
- 在 theme.conf 所在的目录中,添加一个“fulltoc.html”模板,其中包含一行:
fulltoc.html:
{{ toctree(collapse=False) }}
(嘿,注意到“崩溃”论点了吗?)
- 在 sphinx conf.py 中,修改 html_sidebars 选项以添加您的模板;并声明你的主题
conf.py:
html_theme_path = [customized_readable_theme.get_html_theme_path()]
html_theme = 'customized_readable'
html_sidebars = {'**': ['fulltoc.html', 'relations.html', 'sourcelink.html', 'searchbox.html']}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)