On , I learnt ...

How to create an RST table of contents for the current page only

To create a table of contents for the current page in reStructuredText, use the following:

.. contents::
    :local:

Or, in MyST-flavour Markdown:

```{contents}
    :local:
```

This will include links to the headings of the page only. See the docutils docs for other available options.

Note, this doesn’t interfere with Sphinx’s {toctree} directives and can be used to make large, leaf-node pages easier to navigate.