TOC -- table of contents

Shows a Table of Contents that is generated automatically based on headings of a topic. Headings in TopicMarkupLanguage ("---++ text") and HTML ("<h2>text</h2>") are taken into account. Any heading text after "!!" is excluded from the TOC; for example, write "---+!! text" if you do not want to list a header in the TOC

Parameters

Parameter Description Default
"TopicName" topic name Current topic
web Name of web Current web
depth Limit depth of headings shown in TOC 6
title Title to appear at top of TOC  
align Align at left or right side of the page  
id Optional ID in case multiple TOCs are on the page and each TOC needs to be addressable with an anchor link. Allowed characters: a-zA-Z0-9-_, no spaces.
If you don't specify an id, the anchor foswikiTOC can be used in a link: [[#foswikiTOC][Back to TOC]] creates Back to TOC.
"foswikiTOC"
Default settings are defined in DefaultPreferences, and can be overridden in SitePreferences:
Setting Description Value
TOC_MIN_DEPTH The first header level to appear in the TOC 2
TOC_MAX_DEPTH The last header level to appear in the TOC  
TOC_TITLE The default TOC title On this page:
TOC_HIDE_IF_INCLUDED Do not show a TOC if the topic it contains is included in another topic on

Examples

%TOC{depth="2"}%
%TOC{"CompleteDocumentation" web="%SYSTEMWEB%" title="Contents:"}%
See also: Foswiki:Support/HowToCreateATableOfContents
TIP If multiple headers have the exact same text, the anchors for the 2nd, 3rd etc will be suffixed by _AN1, _AN2 etc so the anchors become unique.

ALERT! If other topics are included using INCLUDE then any headingoffset will not be seen by TOC.
Topic revision: r1 - 18 Jun 2015, ProjectContributor
THE UNIVERSITY OF UTAHSPENCER S. ECCLES HEALTH SCIENCES LIBRARY
10 N. 1900 E. SALT LAKE CITY, UT 84112 • 801.581.5534 • IN-STATE TOLL FREE: 866.581.5534 • FAX: 801.581.3632
Ideas, requests, problems regarding Eccles Health Sciences Library wiki? Send feedback