TOC Depth
Quarto Extension
This document demonstrates the TOC Depth extension functionality.
Installation
quarto add mcanouil/quarto-toc-depthThis will install the extension under the _extensions subdirectory. If you’re using version control, you will want to check in this directory.
Usage
Add the filter to your document’s YAML header:
filters:
- toc-depthThen control TOC depth for specific sections using the toc-depth attribute on headers: {toc-depth=N}.
The TOC depth is relative to the section where it is defined.
Section with Default TOC Behaviour
This section uses Quarto’s default table of contents behaviour.
Subsection 1.1
This subsection will appear in the TOC.
Subsection 1.1.1
This nested subsection will also appear in the TOC.
Section with Limited Depth
# Section with Limited Depth {toc-depth=2}This section will appear in the TOC, along with its direct children.
Visible Subsection 3.1
This subsection will appear in the TOC (depth = 2).
Another Section with Single Level
# Another Section with Single Level {toc-depth=1}This section will appear in the TOC, but its direct children will be hidden.
Final Section
This section returns to the default TOC behaviour and will display all subsections according to your document settings.