3

Edit: this other post seems related

I am using the fulltoc extension to display the table of contents in the sidebar.

The global table of contents is defined in the global index.rst file. It is actually composed of a series of toctrees basically:

.. toctree::
   :caption: Getting Started

   gettingStarted/overview
   gettingStarted/section1
   gettingStarted/section2

.. toctree::
   :caption: Next Large section

   group2/overview
   group2/section1
   group2/etc

The overview.rst contains a description of each section and a toctree of the sections that follow. In the folder gettingStarted this file looks like:

Overview
========

This is a description of the section.

.. toctree::

   section1
   section2

The problem is that when looking at the page gettingStarted/overview the sidebar displays the sub-toc, which makes redundant entries:

Getting Started

  • Overview
    • section1
    • section2
  • section1
  • section2

where I would rather have

Getting Started

  • Overview
  • section1
  • section2

One work around is to lower the :maxdepth:, but then the sidebar won't expand sub-sections when reading from a section (such as gettingStarted/section1).

I also found the rubric directive but cannot figure out how to make it work on a toctree.

How can I prevent the sub-TOCs from being indexed into the global TOC?

bad_coder
  • 11,289
  • 20
  • 44
  • 72
leafmeal
  • 1,824
  • 15
  • 15

0 Answers0