mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
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:
@@ -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`
|
||||
|
||||
@@ -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::
|
||||
|
||||
|
||||
Reference in New Issue
Block a user