Python 从sphinx中的侧栏中删除冗余目录树

Python 从sphinx中的侧栏中删除冗余目录树,python,python-sphinx,sidebar,restructuredtext,toctree,Python,Python Sphinx,Sidebar,Restructuredtext,Toctree,编辑:似乎相关 我正在使用扩展在侧边栏中显示目录 全局目录在global index.rst文件中定义。它实际上由一系列的目录树组成,基本上是: .. toctree:: :caption: Getting Started gettingStarted/overview gettingStarted/section1 gettingStarted/section2 .. toctree:: :caption: Next Large section gro

编辑:似乎相关

我正在使用扩展在侧边栏中显示目录

全局目录在global index.rst文件中定义。它实际上由一系列的目录树组成,基本上是:

.. toctree::
   :caption: Getting Started

   gettingStarted/overview
   gettingStarted/section1
   gettingStarted/section2

.. toctree::
   :caption: Next Large section

   group2/overview
   group2/section1
   group2/etc
overview.rst
包含每个部分的说明以及随后各部分的目录树。在文件夹
gettingStarted
中,此文件如下所示:

Overview
========

This is a description of the section.

.. toctree::

   section1
   section2
问题在于,当查看页面
gettingStarted/overview
时,侧栏显示子目录,这会产生冗余条目:

开始

  • 概述
    • 第一节
    • 第2节
  • 第一节
  • 第2节
我宁愿去哪里

开始

  • 概述
  • 第一节
  • 第2节
一种解决方法是降低
:maxdepth:
,但是当从节(例如gettingStarted/section1)读取时,侧栏不会展开子节

我还找到了该指令,但无法找出如何使其在
目录树上工作

如何防止子目录被编入全局目录