/* === ordered: true === */ #TableOfContents ol { /* each list gets a new counter */ counter-reset: item; margin-inline-start: 0; list-style: none; } #TableOfContents ol li:before { /* the counter is added as a pseudo-element, and nested counters are joined by a dot */ content: counters(item, ".") " "; counter-increment: item; /* ensure the counters align visually */ font-family: monospace; font-weight: bold; margin-inline-end: 1em; } #TableOfContents > ol > li { /* top-level items wrap after the number, in order to add some visual separation */ display: flex; flex-flow: column; } /* === ordered: false === */ #TableOfContents ul { list-style: none; margin-left: 0; } #TableOfContents ul ul { margin-left: 1em; }