-
Notifications
You must be signed in to change notification settings - Fork 38
/
VarTOC.txt
20 lines (20 loc) · 1.73 KB
/
VarTOC.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
%META:TOPICINFO{author="ProjectContributor" date="1284962225" format="1.1" version="1"}%
%META:TOPICPARENT{name="Macros"}%
#VarTOC
---+++ TOC{"Topic"} -- table of contents
* Table of Contents. Shows a TOC that is generated automatically based on headings of a topic. Headings in WikiSyntax (="---++ 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
* Syntax: =%<nop>TOC%= OR =%<nop>TOC{"SomeTopic" ...}%=
* Supported parameters:
| *Parameter:* | *Description:* | *Default:* |
| ="TopicName"= | topic name | Current topic |
| =web="Name"= | Name of web | Current web |
| =depth="2"= | Limit depth of headings shown in TOC | 6 |
| =title="Some text"= | Title to appear at top of TOC | none |
| =id="Some_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. %BR% \
If you don't specify an id, the anchor =foswikiTOC= can be used in a link: =[<nop>[#foswikiTOC][Back to TOC]]= creates [[#foswikiTOC][Back to TOC]]. | "foswikiTOC" |
* Default settings are defined in %SYSTEMWEB%.DefaultPreferences, and can be overridden in %USERSWEB%.SitePreferences
* Examples: <pre class="tml">%<nop>TOC{depth="2"}%
%<nop>TOC{"CompleteDocumentation" web="%<nop>SYSTEMWEB%" title="Contents:"}%</pre>
See also: Foswiki:Support/HowToCreateATableOfContents
<blockquote class="foswikiHelp">%T% 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.</blockquote>
<!--%JQREQUIRE{"chili"}%-->