Jed, to my understanding, the TOC macros use tags.
TiddlyWiki provides several macros for generating a tree of tiddler links by analysing tags
I want to create TOC for headings inside a tiddler
! Heading 1
Lorem Ispum
! Heading 2
Example text
Thank you Jed.
Thank you TonyM for your response.
Let us know what you want the toc to do, rather than define it by an existing example like Visual Studio, because then we may have a solution despite the current limitations.
I had a long tiddler with several headings, say “Fish Shell Tips”. I do not want to link to the heading from sidebar or from other tiddler. Instead when I visit the “Fish Shell Tips”, I want to have a TOC on top of tiddler, for quick skimming and jumping to the required heading.
What I ended up doing, taking cue from answers this thread, was to the split the tiddler into smaller tiddlers and tagged them with fish-shell
. Then I created a tiddler for the fish-shell
tag and listed all tiddlers tagged with it inside it,
<<list-links "[tag[fish-shell]sort[title]]">>
Let me know if there is a better way. Also, you said,
However if this is not your key requirement, perhaps you just want a list of headings to summarise the tiddler content, or to list the headings elsewhere, and link to the tiddler that contains them there is other options.
How do I these? Like getting a list of headings or listing headings elsewhere?
You can also use transclusion to build a lengthy tiddler from small tiddlers.
Transclusion is cool. But it’s a manual process. Every time I add a new tiddler, I will have to update the lengthy tiddler manually.
For example, I create a “Fish Shell Tips” tiddler, to show content of “Rename Files” tiddler.
! {{Rename Files !!title}}
{{Rename Files}}
Later, if I add another tiddler on the same topic, “Aliases and Functions”. I will have to remember to edit “Fish Shell Tips” tiddler and add the content
! {{Rename Files !!title}}
{{Rename Files}}
! {{Aliases and Functions !!title}}
{{Aliases and Functions}}
I don’t see any way of telling “Fish Shell Tips” to automatically transclude new content with tag “fish-shell”.
<$list filter='[tag[shell-fish]]'>
<$transclude mode=block/>
</$list>
<$list filter='[tag[shell-fish]]'>
!!{{!!title}}
<$transclude mode=block/>
</$list>
Given you are using transclusion do look at the excise editor toolbar buttons you will it useful. Just type in tge top tiddler and when ready with a section excise it.
Also you could use jeds second list with only the titles at the top if you want a toc like list, however as yet we cant make it jump to that position in the text.
I have some other ideas I will share if they work.
Enjoy tiddlywiki
Tony
Thank you Jed. This is very useful.
Thanks Tony. I am blown away by the capabilities of TiddlyWiki and level of help provided in the community. Really appreciated!
With the help of your code, I ended up with following, which solves my problem nicely.
@@float:right;
{{fish-shell||$:/core/ui/TagTemplate}}
@@
<<tabs "[tag[fish-shell]sort[title]]" default:"" state:"$:/state/tab1" class:"tc-vertical">>
As greg says, the caption works well here and in a table of contents.
In additionto gregs idea about a link to each tiddler listed in the tabs, there is a plugin or two that do this automaticly. I will look it up and share it.
Tony