title: $:/_Sidebar/TableOfContents tags: $:/tags/SideBar caption: Contents \define toc-body(tag,sort:"",exclude,path)
    <$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]"""> <$vars item=<> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}} excluded="""[enlist<__exclude__>] -[<__tag__>]""">
  1. <$link to={{{ [enlist{!!story-tiddlers}] }}}> <$list filter="[enlist{!!story-tiddlers}addprefix[$:/state/viewtemplate/visibility/]text[2]limit[1]]" variable="listItem" emptyMessage="""
    """>
    <$view field='caption'> <$view field='title'/> <$macrocall $name="toc-body" tag=<> sort=<<__sort__>> exclude=<> path=<>/>
\end \define toc(tag,sort:"") <$macrocall $name="toc-body" tag=<<__tag__>> sort=<<__sort__>> /> \end
<>