Add a class option to the toctree directive (#12524)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
Tim Hoffmann
2024-07-10 12:07:49 +02:00
committed by GitHub
parent c67ef51df9
commit a95d716f7f
5 changed files with 32 additions and 1 deletions

View File

@@ -380,6 +380,12 @@ Docutils supports the following directives:
When the default domain contains a ``class`` directive, this directive
will be shadowed. Therefore, Sphinx re-exports it as ``rst-class``.
.. tip::
If you want to add a class to a directive,
you may consider the ``:class:`` :dudir:`option <common-options>` instead,
which is supported by most directives and allows for a more compact notation.
* HTML specifics:
- :dudir:`meta`

View File

@@ -124,6 +124,14 @@ tables of contents. The ``toctree`` directive is the central element.
foo
As with :dudir:`most directives <common-options>`,
you can use the ``class`` option to assign `class attributes`_::
.. toctree::
:class: custom-toc
.. _class attributes: https://docutils.sourceforge.io/docs/ref/doctree.html#classes
If you want only the titles of documents in the tree to show up, not other
headings of the same level, you can use the ``titlesonly`` option::