Sphinx侧栏中的章节标题

时间:2015-03-29 03:15:51

标签: python documentation python-sphinx restructuredtext

有没有办法在Sphinx文档的左侧菜单中添加章节标题? 我知道你可以使用MkDocs(例如here),但有没有办法在Sphinx和ReSTructured文本中做到这一点?

我想将我的文档分成不同的部分(例如安装说明,运行程序等),这些部分的标题在左侧菜单中显示为文本。

2 个答案:

答案 0 :(得分:1)

最后想出你如何在Sphinx中做到这一点......

有一个:caption:指令允许您在内容列表中添加标题。例如,readthedocs的目录如下所示:

.. toctree::
   :maxdepth: 2
   :caption: User Documentation # <-- This is what I was looking for

   getting_started
   versions
   [...]

:caption: User Documentation添加&#34;用户文档&#34;部分标题到侧边栏:

enter image description here

我不知道为什么在标题后面有所有的空间,但我想这只是主题的一个问题......

答案 1 :(得分:0)

conf.py更新html_sidebars,如下所示:

html_sidebars = {'**': ['localtoc.html']}