On Sunday, August 9, 2020 at 5:04:13 AM UTC-7, Bob Flandard wrote:
I did exactly this function as part of the InsideTW "page navigation" interface.
It does a recursive "walk" of a "tag tree", and generates a flat list of tiddler titles:
\define toc-list(here,max,exclude,level:"1")
<$list filter="""[tag[$here$]] $exclude$ -[[$here$]]""">
<$link /><br>
<$reveal default="$level$" type="nomatch" text="$max$">
<$macrocall $name="toc-list" here=<<currentTiddler>> max="$max$" exclude="""$exclude$ -[[$here$]]""" level={{{ [[$level$]add[1]] }}}/>
</$reveal>
</$list>
\end
Invoke it like this:
where "some name" is the top-level tag for your tree.
Notes:
1) There is also an optional "max" parameter to limit the depth of traversal
2) The "exclude" and "level" parameters are only for internal use by the macro itself
3) The default output just lists each title, one per line. If you want a bullet list, you could change this line:
to this:
and if you want a numbered list, also wrap the macro invocation within <ol>...</ol>, like this:
<ol><<toc-list "some name">></ol>
enjoy,
-e