【问题标题】:Sphinx (RTD Theme) section navigation is not consistentSphinx(RTD 主题)部分导航不一致
【发布时间】:2019-04-22 04:33:46
【问题描述】:

我的问题很难用语言来表达。我会尽力而为。

使用 Sphinx 2.0.0,我有一个带有以下“根”目录树的项目。这是索引目录树:

Welcome to FIRST Robotics Documentation
========================================================

.. toctree::
   :maxdepth: 2
   :caption: WPILib Software

   software

.. toctree::
   :maxdepth: 2
   :caption: WPILib Hardware

   hardware

.. toctree::
   :maxdepth: 2
   :caption: Robot Networking

   networking

这很好用。

我现在的结构有点像这样:

现在让我们使用"software" toctree 索引页面

.. toctree:: 
   :maxdepth: 1

   quick urls here

Getting Started
===============

.. toctree::
   :maxdepth: 1

   docs here

WPILib Overview
===============

.. toctree::
   :maxdepth: 1

   docs here

这给了我一个如下所示的页面:

但是,问题在于您何时开始导航到子子目录树。当您进入“WPILib Overview”部分时,顶部导航栏显示为“Getting Started”,这在其他部分中也可以重现。

在上图中,它应该显示“WPILib Overview”而不是“Getting Started”。不幸的是,它没有。

源代码公开在:https://github.com/daltz333/frc-docs 网页来源及问题网址:https://frc-docs.rtfd.io/en/develop

我想不出任何解决方案,除了将每个部分都分解成自己的文件,这不是一个选项。

【问题讨论】:

  • 您找到解决方法了吗?如果是,请添加答案。

标签: python-sphinx sidebar navigationbar read-the-docs toctree


【解决方案1】:

您需要在conf.py 中将navigation_depth 设置为html_theme_options 的属性,即:

# 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 = {
    'navigation_depth': 2
}

有关更多信息,请参阅their documentation 主题选项的配置。

【讨论】:

  • 这是不正确的,我的问题实际上是 Sphinx 的“书”风格阅读文档。我的问题是导航的“标题”不正确,也不一致。增加深度级别不能解决此问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-10-16
  • 1970-01-01
  • 2017-02-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多