created: 20140919155729620 modified: 20150221224034000 tags: Macros [[Core Macros]] title: Table-of-Contents Macros type: text/vnd.tiddlywiki ~TiddlyWiki provides several macros for generating a tree of tiddler links by analysing [[tags|Tagging]]: ;<<.var toc>> : A simple tree ;<<.var toc-expandable>> : A tree in which all the branches can be expanded and collapsed ;<<.var toc-selective-expandable>> : A tree in which the non-empty branches can be expanded and collapsed ;<<.var toc-tabbed-internal-nav>> and <<.var toc-tabbed-external-nav>> : A two-panel browser: :* on the left, a selectively expandable tree that behaves like a set of vertical tabs :* on the right, the content of whichever tiddler the user selects in the tree The difference between the last two has to do with what happens when the user clicks a link in the right-hand panel: ;<<.var toc-tabbed-internal-nav>> : The target tiddler appears in the right-hand panel, replacing the tiddler that contained the link ;<<.var toc-tabbed-external-nav>> : The target tiddler appears in the normal way (which depends on the user's configured storyview) !! Structure The top level of the tree consists of the tiddlers that carry a particular tag, known as the <<.def "root tag">>. Tiddlers tagged with any of those make up the next level down, and so on. At each level, the tiddlers can be [[ordered|Order of Tagged Tiddlers]] by means of the <<.field list>> field of the parent tag tiddler. They can also be ordered by the macro's <<.param sort>> parameter. The tree displays the <<.field caption>> field of a tiddler if it has one, or the tiddler's title otherwise. Each tiddler in the tree is normally displayed as a link. To suppress this, give the tiddler a <<.field toc-link>> field with the the value <<.value no>>. In the [[examples|Table-of-Contents Macros (Examples)]], the SecondThree tiddler is set up like this. Clicking such a tiddler in the tree causes its branch to expand or collapse. The table of contents is generated as an HTML ordered list. The `