微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在 Sphinx 的主目录中隐藏部分标题?

如何解决如何在 Sphinx 的主目录中隐藏部分标题?

我正在为使用 Sphinx 的 Python 项目编写文档。主页有一个目录,认情况下,Sphinx 中的 toctree 指令包括页面标题下方的部分标题。我觉得这太过分了,在可用性方面。直觉上,我希望每页有一个链接。为所有部分提供子链接使文档看起来比实际情况复杂得多。

:titlesonly: 选项修复了这个问题,但实际上在页面上时也会从侧边栏删除部分标题。我不想丢失它们,因为它们是有用的“当前页面”目录。

有没有办法将部分标题首页的目录中排除,同时将它们保留在侧边栏中?

没有 :titlesonly: 的示例

index.rst:

Example Documentation
=====================

Table of Contents
-----------------

.. toctree::
   :maxdepth: 2

   installation
   api
   support

installation.rst:

Installation
============

From PyPI
---------

Lorem ipsum dolor sit amet...

From Source
-----------

Lorem ipsum dolor sit amet...

(其他 .rst 文件以此类推)

index.html:

enter image description here

installation.html:

enter image description here

:titlesonly: 示例

index.rst:

Example Documentation
=====================

Table of Contents
-----------------

.. toctree::
   :maxdepth: 2
   :titlesonly:

   installation
   api
   support

(其他 .rst 文件不变)

index.html:

enter image description here

installation.html

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。