How to setup Table of Content in TiddlyWiki
Asked Answered
J

3

6

If I go TiddlyWiki site I can see tab Content. How can I create my own table of content for my tiddlywiki file?

Jody answered 26/8, 2015 at 18:31 Comment(1)
Youtuber does exactly that in this video: youtube.com/…Companion
S
5

Create a new tiddler and give the title Contents

Under tags, give the value $:/tags/SideBar

Under type the text for this tiddler, give <$list filter={{$:/core/Filters/AllTiddlers!!filter}} template="$:/core/ui/ListItemTemplate"/>

Sunnysunproof answered 16/2, 2016 at 5:1 Comment(1)
This is great - it works in my firefox on windows, TiddlyWiki 5.1.9. Many thanks for your answer.Jody
P
7

I found the documentation for this really confusing, but here's what I did that works best:

<div class="tc-table-of-contents">

<<toc-selective-expandable 'TableOfContents' sort[ind]>>

</div>

Then, tag each tiddler with TableofContents.

Lastly, when editing each tiddler, add a new field named "ind" (for index - you can change this to whatever you like, so long as it's not being used elsewhere, of course). Assign a value to "ind" starting with 0 to tell it what order you want the tiddlers to go in. I incremented by 10 instead of 1 in case I want to rearrange a few things or insert more in the middle.

Promoter answered 1/11, 2016 at 7:5 Comment(1)
Yeah man the docs didn't make much sense at all. I'll try this. Thank you.Untuck
S
5

Create a new tiddler and give the title Contents

Under tags, give the value $:/tags/SideBar

Under type the text for this tiddler, give <$list filter={{$:/core/Filters/AllTiddlers!!filter}} template="$:/core/ui/ListItemTemplate"/>

Sunnysunproof answered 16/2, 2016 at 5:1 Comment(1)
This is great - it works in my firefox on windows, TiddlyWiki 5.1.9. Many thanks for your answer.Jody
A
3

This is explained in the documentation.

The short version: Add some tag (e.g. Content) to the pages you want to appear in the TOC; then in the place where you want it to appear, use one of the macros with that tag name (e.g. <<toc Content>>). To make a nested TOC, tag pages with the names of tags that appeared at the top level. So for example if you have a tiddler named First that is tagged with Content, then you can tag more tiddlers with First, and they will appear indented below First in the TOC.

Annulet answered 7/9, 2015 at 17:21 Comment(5)
The docs are a bit confusing. I am looking to generate a table of contents within a given tiddler that's very long: e.g. for its own h1s, h2s, etc. Do you know of a way to generate a table of contents for the hierarchy like this within a single tiddler for that single tiddler itself? Edit: It sounds like this may not be possible :( according to groups.google.com/g/tiddlywiki/c/5rosst5JqTU.Spikelet
I don't think I understand the question. A tiddler with a table of contents... "for the tiddler itself"? As in, it lists exactly one item, which is itself? What use is that?Annulet
As in it lists an outline of the hierarchy of that tiddler. Like what a table of contents extension in Markdown does. Example: python-markdown.github.io/extensions/toc.Spikelet
I don't know a way to do that, but I would suggest that it's not how tiddlers are meant to be used anyway. Try putting less text on each; you'll be happier in the long run, since you'll have more opportunities to, e.g. make useful cross-references, include sections in categories, etc.Annulet
That approach unfortunately doesn't scale super well for this use case. (It's hundreds of one line items that change frequently through bulk editing.)Spikelet

© 2022 - 2024 — McMap. All rights reserved.