【问题标题】:Sphinx rtd docs dropdown only works post clickSphinx rtd docs 下拉菜单仅在点击后有效
【发布时间】:2022-01-18 01:17:00
【问题描述】:

我使用sphinxsphinx_rtd_theme 为我的包创建了一个以rtd 为主题的文档。 index.rst如下:

Welcome!

.. toctree::
   :maxdepth: 1
   :glob:

   src


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

而src文件大致遵循这个思路:

================
Template Project
================
.. automodule:: src
   :members:
   :undoc-members:
   :show-inheritance:

.. toctree::
   :maxdepth: 4

   features
   io
   model
   utilities

conf.py中的html_theme_options也如下:

html_theme_options = {
    "analytics_anonymize_ip": False,
    "logo_only": False,
    "display_version": True,
    "prev_next_buttons_location": "bottom",
    "style_external_links": False,
    "vcs_pageview_mode": "",
    # Toc options
    "collapse_navigation": True,
    "sticky_navigation": True,
    "navigation_depth": 4,
    "includehidden": True,
    "titles_only": False,
    "globaltoc_collapse": True,
    "globaltoc_maxdepth": None,
}

我现在遇到的问题是,下拉菜单无法正常工作。它们不会出现在侧边栏中,除非我单击一个附近应该有下拉按钮的项目。

点击侧边栏链接后,我将转到下一个文件,这是一个打开的下拉菜单。

我想做的是,我希望从第一项开始就有下拉选项。这是笨拙且不直观的。

【问题讨论】:

    标签: documentation python-sphinx documentation-generation read-the-docs


    【解决方案1】:

    根据docs for the theme,可以设置collapse_navigation = False

    【讨论】:

    • 我不敢相信我错过了这个。非常感谢!
    猜你喜欢
    • 2023-02-18
    • 1970-01-01
    • 1970-01-01
    • 2014-01-29
    • 1970-01-01
    • 1970-01-01
    • 2015-08-16
    相关资源
    最近更新 更多