Trying to install https://kookma.github.io/TW-TOC/ plugin

I’m trying to install TOC Plugin.

I followed the instructions and the plugin appeared to be installed so I suspect my problem is more likely that I don’t really know what to do to get it to work. I am completely new to TW so struggling to figure out how to do things.

I see a tag structure on the examples on the TOC Plugin Private 1.6.3 — table of contents with navigation tools website and tried to apply it to a few of the tiddlers in my application but I’m not seeing a new tab like the ones on the demo website.

I was expecting to see a new tab on the panel to the right with the original 5 tabs but nothing has changed.

The plugin information talks about some macros. Do I need to run these and if so how do I run them?

Would really appreciate assistance from anyone that can give me some guidance.

Thanks

So, I assume you have an established set of tiddlers that form a TOC (that is, tiddlers that tag other tiddlers) ?

Mohammad 's macros allow you to form a TOC from tiddlers that have been used to tag other tiddlers. There’s a set of these macros already in TiddlyWiki, but one of Mohammad’s version adds navigation so you can move up and down the TOC tree. Another version limits the tree to two levels, enhancing performance. The macros have nothing to do with tabs appearing in the sidebar (that is done with a special tag – see below).

So in whatever tiddler you would like the TOC to occur, per the instructions you put something like this at the top:

\import [all[tiddlers+shadows]tag[$:/tags/Macro/Toc]]

This allows the macro to exist inside the tiddler. And then you put the macro like this inside the tiddler:

<<twolevel-toc-expandable tag:"book" exclude:"" stateTiddler:"20200220">>

Except of course your “tag” would be whatever your top level tiddler in your TOC structure was.

Now if you add the tag $:/tags/SideBar to this tiddler, it will appear over in the sidebar. If you add a caption field to this tiddler, then the contents of the caption field will be the title that is shown over in the sidebar.

There are other tools in the Demo to allow you to add navigation within tiddlers that are part of the TOC. But you can read about them in the tutorial.

Hopefully this will get you started.

Good luck!

1 Like

Thank you Mark.

This is working now.

I do find the highlight feature confusing because it doesn’t get updated as you move around on open tiddlers. I would like to shut it off if possible. Do you know of any way to shut this feature off?

The feature I’m referring to is

  • track and highlight the TOC entry opened from table of contents or by navigation buttons

Thank you for your assistance.

Alan

The navigation highlights as you navigate if you set up a TW-TOC template, and use the navigation footer to move between tiddlers.

@Mohammad describes how to do this, for instance, under the tab Two level hierarchical navigation

I guess the question is, which feature in TW-TOC did you need? If you don’t want the highlighting, and/or don’t need a limited two-level hierarchy, then maybe you actually just need the standard TOC macros? They’re already built into TW. There’s a variety of types to choose from. You can read about them here:

Table of Contents Macros

The main features I want is to be able to open and close each topic individually AND the ability to close all open topics by clicking a single button. I don’t think any of the built in TOC methods allows for both of these features. I do expect users to select fairly unrelated topics so the next / previous method would not be used much.

The following is a bit of a hack.

If you go to tiddler

$:/plugins/kookma/toc/styles/main

Edit, and scroll down to where class kk-toc-opened-item is defined, you can replace it with the following:

.kk-toc-opened-item{ 
	text-decoration: none;
	font-weight: 500;
	color: #5778d8; ;
	-webkit-user-select: inherit; /* Otherwise the draggable attribute makes links impossible to select */
	-webkit-touch-callout: none; /* Prevents long presses from bringing up a link preview */}

When I said this was a hack, I’m referring to the color attribute, which you will have to change appropriately if you are not using the standard color palette. It should have worked to replace it with macro call <<tiddler-link-foreground>>, but that didn’t work and I didn’t want to spend hours to find out why.

HTH !

This works beautifully.

The only minor issue is that the selected topic line remains highlighted (darker text). If that could be changed to not highlight it would be perfect but it’s 95% perfect as is. Do you know of a way to not set the highlight without spending much time on it?

Even with the highlight I am very happy with the result. Thank you so much for your help.

Oh, it was so subtle that I didn’t spot it.

Make the same changes as above, but with content:

.kk-toc-opened-item{ 
	text-decoration: none;
	font-weight: normal;
	color: #5778d8; ;
	-webkit-user-select: inherit; /* Otherwise the draggable attribute makes links impossible to select */
	-webkit-touch-callout: none; /* Prevents long presses from bringing up a link preview */}

Still getting same result. The selected item is in darker text.

But on second thought, after working with it, I do see an advantage to having the highlight so there is no need to spend any more time on it.

Thank you very much for the assistance you have provided.