サイドバーの toctree のこの動作は、Read the Docs テーマ ( https://github.com/snide/sphinx_rtd_theme )の機能です。
でインストールしますpip install sphinx-rtd-theme
テーマにはcollapse_navigation
、ドキュメントの別の部分に移動するときにツリーを自動的に折りたたむかどうかを制御するオプションがあります。
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
"collapse_navigation" : False
}
indexr.rst:
#################
Title
#################
Animals
=======
.. toctree::
:maxdepth: 2
animals/index
Flowers
=======
.. toctree::
:maxdepth: 2
flowers/index
動物/index.rst:
####################
Animals
####################
.. toctree::
:maxdepth: 2
cat
dog
moose