NOTE: This is a static archive copy of STWiki. The site can no longer be edited.

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 to the first TOC: [[#foswikiTOC][Back to TOC]] creates Back to TOC. Multiple TOC macros will increment the generated ID. #foswikiTOC, #foswikiTOC2 ... "foswikiTOC"

Preference Settings

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 specified on the INCLUDE macro will not be seen by TOC.
Topic revision: r1 - 04 Dec 2015, ProjectContributor
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding STWiki? Send feedback