9

index.rst に次のような toctree があります。

.. toctree::
   :maxdepth: 2

   cat
   dog
   moose

ここで「api documentation」を使用して行う方法と同様に、toctree の内容をネストすることを検討しています。

ここに画像の説明を入力

したがって、最終的に次のようなものを作成します。

.. toctree::
   :maxdepth: 2
   :dropdown Animals
     cat
     dog
     moose

しかし、ドキュメントでこれを行うものを見つけることができないようです。

4

1 に答える 1

18

サイドバーの 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
于 2016-04-29T09:40:45.707 に答える