Skip to content

Section Hierarchy Must Be Linear

Heli Aldridge edited this page Feb 9, 2024 · 2 revisions

When writing reStructuredText, you must not reopen a parent section within a directive.

Not Allowed

For example, the following is ill-defined:

=================
Top Level Section
=================

A Parent Section
----------------

.. tabs::

   .. tab::

      The Same Section Level
      ----------------------

The reason is that the section hierarchy is no longer necessarily be a tree: the parent section's parent, the Top Level section, is being added to from within a deeper level in the document tree and this is not a structure that reStructuredText currently supports.

Allowed (Linear Section Structure)

However, directives may contain sections that are children of the current section level. For example:

A Parent Section
----------------

.. tabs::

   .. tab::

      A Child Section
      ~~~~~~~~~~~~~~~
Clone this wiki locally