1.5 KiB
1.5 KiB
You can add a table of contents to a page using toc
Blocks.
In its most basic form it looks like this (click the edit button to see the code):
You can use it in two ways:
- Manually, by adding a
toc
widget to the pages where you’d like to render a ToC - Automatically, using a Live Template Widgets
To have a ToC added to all pages with a larger (e.g. 3) number of headings, it is recommended to use Library/Core/Widget/Table of Contents.
Configuration
In the body of the toc
code widget you can configure a few options:
header
: by default a “Table of Contents” header is added to the ToC, set this tofalse
to disable rendering this headerheaderText
: by default "# Table of Contents\n". Change it to change the rendering of this headerminHeaders
: only renders a ToC if the number of headers in the current page exceeds this number, otherwise renders an empty widgetmaxHeaders
: only renders a ToC if the number of headers in the current page is below this number, otherwise renders an empty widgetminLevel
: only renders a ToC for headers below that level (if you do not want to display e.g. the first header)maxLevel
: only renders a ToC down to this level (e.g. if you have too many sublevels.)
Example:
header: false
minHeaders: 1
Want to add a table of contents to all your pages automatically? You can — that’s functionality available via the Library/Core library.