{toc} writes a table of contents of the page it stands in, from the page's own
rendered headings - <h2> and <h3> by default - as a
<nav> with nested, linked lists. Like {stack}, the tag writes a
marker that is filled in once the whole page has rendered, so the headings below it are listed
too, including the ones a loop, a snippet or a {markdown} produced.
A heading without an id gets one to link to: the slug of its text, with -2,
-3 behind a repeat, never an id the page already has. A heading with an id keeps
it. A level one deeper nests one list deeper, never more than one step in, so a page that skips
from <h2> to <h4> still gives a sound list. The title is a
paragraph rather than a heading, so the contents never list themselves. Without a heading of
the chosen levels, the tag writes nothing.
The marker is filled in when the request's page ends and also when a {page} pass
ends for a page it renders, so a {toc} in such a page lists the headings of that
page alone - which is how the examples here list their own headings and not those of this page.
Colours are --pad-toc-* custom properties with light-dark() defaults.
Levels outside 1 to 6 and a list other than ol or ul are strict
errors.