TOC from Headings in Tiddler

199 views
Skip to first unread message

Tony Grosinger

unread,
Jan 16, 2018, 11:41:33 AM1/16/18
to TiddlyWiki

I frequently use a single Tiddler to group a bunch of examples on a related topic. For example, I may have one which groups examples for the sed command.

Here is an example:

! Installation

You found a computer that doesn't come with it installed??

! Examples

!! Replacing in-place

It seems like some systems don't behave well when you exclude the 
backup file location. Best to just include it and remove it afterwards.

`sed -i.bak -e 's/hi/hello/g' *.go`

!! Using Regex Groups

You have to escape the parens that are part of the grouping. This example looks for 
an instance of `somethin` followed by any letter. It upper-cases the final 
letter and does not remove the `somethin`.

`sed -i.bak -e 's/\(somethin\)\(.\)/\1\u\2/g' *.go`

! References

* [[Official Manual|https://www.gnu.org/software/sed/manual/sed.html]]

I would love to have a template which generates a table of contents based on the headings in a Tiddler and displays that TOC at the top of the tiddler when rendered. Does such a thing exist? Or what would be the simplest way of creating this if it does not.

Thank you.

Thomas Elmiger

unread,
Jan 16, 2018, 4:13:02 PM1/16/18
to TiddlyWiki
Hi Tony,
I only have some hints for you, no solution … but I had thought about the subject before and I am not sure it would be useful:

TiddlyWiki lacks a possibility to make intra-tiddler links. Jumping around in a single tiddler seems to be impossible as the # is used in other ways. So would a barely visual TOC be useful?

I have a script here otherwise that extracts titles from HTML to generate a TOC: https://thomas-elmiger.ch/bookmarklet/tibofix.html – I guess you want something like that. I did not try to adapt this to TW though.

Instead I made the details widget to place collapsible sections in a single tiddler: https://tid.li/tw5/plugins.html#DetailsWidget

That gives your reader an overview and fast access to contents, but not as detailed a structure as would be possible with headings.

Good luck!
Thomas

Tony Grosinger

unread,
Jan 16, 2018, 4:37:48 PM1/16/18
to tiddl...@googlegroups.com
TiddlyWiki lacks a possibility to make intra-tiddler links. Jumping around in a single tiddler seems to be impossible as the # is used in other ways.

Oh that is definitely a bummer. That was my primary use case. Thanks for the info anyways! 

TonyM

unread,
Jan 16, 2018, 10:10:36 PM1/16/18
to TiddlyWiki
Tony,

It may be possible if you just want a list of heading items not actual links to that part of each tiddler.
May still be of some value
Just ask if this is enough?

Regards
Tony

Tony Grosinger

unread,
Jan 17, 2018, 11:07:23 AM1/17/18
to TiddlyWiki
It may be possible if you just want a list of heading items not actual links to that part of each tiddler.

Hmm, I don't think that would work for my use case. Thank you though 

Mark S.

unread,
Jan 17, 2018, 11:38:18 AM1/17/18
to TiddlyWiki
If you did things the "TW5 Way" (https://tiddlywiki.com/#Philosophy%20of%20Tiddlers) then what you would is break each of those sections into their own tiddler, and then transclude them back into your all-up tiddler (possibly with a single list widget). Then it would be easy to make a TOC at the top. Only that when you clicked on a link, you would go to the source tiddler for that section instead of indexing inside your all-up tiddler. I guess this would give you an opportunity for distraction-free editing of just that section tiddler.

-- Mark

@TiddlyTweeter

unread,
Jan 17, 2018, 11:41:44 AM1/17/18
to TiddlyWiki
Right. It's a bummer. It blocks lots of use cases. It makes things that are normally easy difficult. Its an architectural issue. And I think one that should be looked at.

André Carvalho

unread,
Apr 10, 2019, 6:28:43 AM4/10/19
to TiddlyWiki
Hi all

I used a TiddlyTOC plugin in Classic TiddlyWiki that was perfect ( See example at http://acarvalho.tiddlyspot.com/#%5B%5BWriting%20Good%20Requirements%5D%5D ). And can not find anything similar for 5. (Please keep the "tiddler philosophy" off the discussion, TiddlyWiki is a tool, an amazing one, and I'll use it as I can and want.).
I think that we lost a lot (and gained another lot) on the breaking upgrade from Classic and I do not see TW 5 plugins gaining momentum to get even close to what we had in Classic. That's unfortunate because TiddlyWiki is such an amazing tool that can be used in so much different ways. In my humble view part of the problem may be the excessive use of the "tiddler philosophy" answer... if it is architecturally possible, please, just consider it and let each user decide how they want to use our beloved TiddlyWiki.

Best regards
André
Reply all
Reply to author
Forward
0 new messages