全部折叠:全局:-发现的文件合并到一个目录条目中 [英] Collapse all :glob:-discovered files into one TOC entry
本文介绍了全部折叠:全局:-发现的文件合并到一个目录条目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的东西:
.. toctree::
:maxdepth: 2
:caption: Contents:
:hidden:
:glob:
docs
frontend
backend
tools/*
我希望tools
目录中的所有文档都折叠到一个可展开的侧栏目录条目中。应该有可能,但我找不到任何线索。
我使用sphinx_rtd_theme
。
换句话说:假设我有一个非常长的文档,如下所示(tools.rst
):
Section 1
*********
Subsection 1
============
Subsection 2
============
Subsection 3
============
我应该如何按子部分拆分它并保留文档结构,而不求助于Include,这对Sphinx来说本来就不太合适。
推荐答案
source/index.rst
:
.. toctree::
:maxdepth: 2
:caption: Contents:
:glob:
tools/_tools
docs
frontend
backend
tmp/*
旧source/tools/_tools.rst
:
Notes on tools
**************
.. include:: black.rst
.. include:: docker.rst
.. include:: git_hooks.rst
.. include:: github_webhooks.rst
.. include:: mypy.rst
.. include:: pipm.rst
.. include:: poetry.rst
.. include:: sphinx.rst
.. include:: uvicorn.rst
新增source/tools/_tools.rst
:
Notes on tools
**************
.. toctree::
:maxdepth: 2
:glob:
*
新版本的外观与旧版本一模一样,功能更丰富、更简洁。
这篇关于全部折叠:全局:-发现的文件合并到一个目录条目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文