【发布时间】:2015-03-29 03:15:51
【问题描述】:
有没有办法在 Sphinx 文档的左侧菜单中添加章节标题? 我知道如果您使用 MkDocs(例如 here)可以做到这一点,但有没有办法在 Sphinx 和 ReSTructured 文本中做到这一点?
我想将我的文档分成单独的部分(例如安装说明、运行程序等),这些部分的标题在左侧菜单中显示为文本。
【问题讨论】:
标签: python python-sphinx sidebar sections toctree
有没有办法在 Sphinx 文档的左侧菜单中添加章节标题? 我知道如果您使用 MkDocs(例如 here)可以做到这一点,但有没有办法在 Sphinx 和 ReSTructured 文本中做到这一点?
我想将我的文档分成单独的部分(例如安装说明、运行程序等),这些部分的标题在左侧菜单中显示为文本。
【问题讨论】:
标签: python python-sphinx sidebar sections toctree
终于想通了如何在 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']}
【讨论】: