How an automatic table of contents work
Table of contents is used for long documents where it is important for users to get a quick overview of the content and be able to jump to the desired section. Examples are user guides or long case documents.
Example of a table of contents used on uio.no
How to add a table of contents
- Create the document with formatted headings
- Copy the code
- Paste the code at the top of the document
$<slettmeg>{resource:toc}
NOTE! Remove "<slett meg>" in the code to make the code work.
Change title
The title is automatically set to "Table of contents". If you want another title, enter "title=[nytittel]" after "${resource:toc" - like this:
${resource:toc title=[Dagsorden]}
List of Heading 2 only
You can make the component that creates an automatic table of contents for only the top level of headings "Heading 2" by adding the component like this:
<div class="vrtx-toc-only-one-level">
${resource:toc}
</div>
Change the font size
There are some special clauses you can add to source code to control the appearance of the table of contents.
Reduce the size of headings of table of contents from h2 to h3
<div class="vrtx-toc-style-like-h3">
${resource:toc}
</div>
Reduce the size of headings of table of contents from h2 to h4
<div class="vrtx-toc-style-like-h4">
${resource:toc}
</div>