Installation and usage
======================
Installation
------------
``sphinx-structured-toc`` is available on `PyPI `_. Install it with ``pip``:
.. code-block:: console
pip install sphinx-structured-toc
or with ``uv``:
.. code-block:: console
uv add sphinx-structured-toc
The extension requires Python 3.10 or later, Sphinx 7.x, and docutils 0.21.2 or later.
Add ``sphinx_structured_toc`` to the ``extensions`` list in ``conf.py``:
.. code-block:: python
extensions = ["sphinx_structured_toc"]
No other configuration is required. The extension ships a small CSS file that is automatically copied into your build's ``_static`` directory and linked from every page.
A minimal example
-----------------
A ``domain`` contains one or more ``slice`` blocks. Each ``slice`` contains one or more ``:doc:`` item lines, one per line:
.. code-block:: rst
The model layer
~~~~~~~~~~~~~~~
.. domain::
.. slice:: Models
:doc:`Field types `
:doc:`Custom fields `
.. slice:: Queries
:doc:`Lookup expressions `
:doc:`Queryset operations `
This renders as a single ``