有没有办法在 Sphinx 文档的左侧菜单中添加章节标题?我知道如果您使用 MkDocs(例如此处)可以做到这一点,但有没有办法在 Sphinx 和 ReSTructured 文本中做到这一点?
我想将我的文档分成单独的部分(例如安装说明、运行程序等),这些部分的标题在左侧菜单中显示为文本。
终于弄清楚了如何在Sphinx中做到这一点......
有一个:caption:
指令允许您向目录添加标题。例如,readthedocs的目录如下所示:
.. toctree::
:maxdepth: 2
:caption: User Documentation # <-- This is what I was looking for
getting_started
versions
[...]
将:caption: User Documentation
“用户文档”部分标题添加到侧边栏:
我不知道为什么标题后面有那么多空白,但我想这只是主题的问题......
在conf.py
更新 html_sidebars 如下:
html_sidebars = {'**': ['localtoc.html']}