Generate a navigable table of contents for tiddlers using the H1~H6 headings of the tiddlers. That’s right, it’s a headline table of contents generated for a single tiddler. And the table of contents is navigable by clicking on it, meaning it will scroll to where the title is!
Although TiddlyWiki’s organizational logic does not recommend writing excessively long tiddlers, there will always be times when you read long tiddlers. I’m sure all users who have had similar experiences have wondered if it would be nice to have a table of contents for individual long tiddlers, after all, it’s a pain to get lost in long articles. I am also one of them.
This plugin provides a widget <$page-toc> that can generate a table of contents for a tiddler with the following parameters.
CurrentTiddlerTOC You can display the name of the currently focusing tiddler and generate a table of contents, but it requires the support of Hotzone Plugin.
PageTOCButton Add a button to the toolbar for each tiddler and click it to display the table of contents.
I am having trouble finding the demo of this on the link you provided, despite your post saying VIEW and install, and showing a screenshot. Could you send a tiddler-specific link to a demo of this? I would love to see this in action before downloading.
@DaveGifford I have added an example at the bottom of the preview page. Since there is a delay in the GitHub Page, you may have to wait a while to see it.
Thank you! At first, I was having all headings scroll to the top, but they scroll to the very top of the window, which means that if a plugin like menubar is installed, then the headings are blocked by the elements above them.
This is not a plugin library that belongs to me alone, it is a public plugin library maintained by many people(me, olfg, linonetwo, etc.) and contains many useful third-party plugins. We will officially release this plugin library to the community when it is ready.
This is great! Working with together and making useful stuff! This is rarely seen in TW community and while there are collaboration on core development you can find no or few other cases!
I would be happy to distribute kookma plugins through CPL!
Cool! Thanks! I second Mohammad that a way to scroll back to the top would be great. Though you do have the toc in the viewtoolbar, so that reduces the need quite a bit.
One recommendation would be for the default for the toc be single-spaced. The viewtoolbar button will also get long in a hurry at double-spacing.
I’m not sure whether you’re still supporting this plugin, @Sttot, but I noticed some odd behavior with the ViewToolbar button when I was testing it out (both in your example and in my own wiki).
The first time I click on a heading in the button dropdown, it navigates to the appropriate place.
If I click on the button again, the dropdown shows only a single option, no matter how many there were originally. This behavior persists until I edit the tiddler or reload the wiki.
As an unrelated question (more a plugin conflict than a real bug, I think): Has anyone gotten the Page TOC to work with Mohammad’s Section Editor?
In my testing, the TOC dropdown shows up as expected in tiddlers with the se-type field (which forces a custom ViewTemplate), but clicking on a link does not scroll to the appropriate point.
Yes, Section editor uses a custom view template through cascades. I can confirm this behaviour. Page TOC uses JavaScript and I cannot help here! Let’s see what @Sttot advice here.
@Sttot
Section editor uses a viewtemplate through cascades, but the content (tiddler text) is the same for tiddler with se-type field and without it!