Dividers in TOC

Is there a way to include dividers in the middle of the TOC? For example, I’d like to have:

  • Entry
    **Subentry
    **Subentry
  • Entry
    **Subentry

  • Entry
    **Subentry
  • Entry
    **Subentry

And so on. Right now, I’m doing it with tiddlers, with parents, ordering fields, and titles like
“Notes -------------”

Alternately, is it possible to have tabbed toc that ALSO includes selective-expandable?

1 Like

I was able to get it to work with CSS. Does this make sense?

Obviously, this is for a very specific TOC menu item.

 a.tc-tiddlylink[href="#Chart%20Configuration"] {
  display: inline-block;
  position: relative;
  padding-bottom: 8px;
} 

a.tc-tiddlylink[href="#Chart%20Configuration"]::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background-color: white;
}
1 Like

Makes sense, butnot quite what I’m looking for. it’s not super common (I only want 2-3, for example), so I could do the same via an inline span or div.

I’m more looking for the “----” horizontal rule but in the middle of the ToC.

Still - thank you! I’m going to go check out the snippet library too…

I did have another ide that I need to test: apply a filter to the toc widget, then actually use “----”, then create a new toc widget filtered fo the next section, and so on.

It worked! I was able to create an HR, with subsets of tiddlers creating multiple filtered TOCs. In the TOC tiddler, I put:

<div class="tocp tc-table-of-contents">
<<tocP-selective-expandable root "tag[grammar]nsort[ord]">>
</div>
 
 ----
 
<div class="tocp tc-table-of-contents">
<<tocP-selective-expandable root "tag[notes]nsort[ord]">>
</div>

Only those two tiddlers have been tagged, at the moment, which is why there are only two items showing up.

I haven’t been able to get the innate toc to work - have to use the tocP plugin. If I disable, will that fix it? If not, no biggie.

I think the cleanest (as in not diving into CSS black magic, which is completely different, and much more different than HTML if compared to wikitext) way would be if the core ToC template code could honor some special tiddler fields a la caption to draw these separators. To control their position in the ToC, tiddlers could have special fields similar to list-before and list-after, like separator-after to draw a separator in the ToC right after rendering said tiddler. But this looks more like a discussion topic about an eventual feature request, which will have to decide if it’s not feature bloat, if it will be expected from the core to support it. Otherwise the CSS approach is fair, as long as one knows it (if you find this statement strange, it’s because it is coming from somebody with huge CSS-phobia :laughing: )

1 Like

I definitely would love to see it as a “separator” field too. My method (no css, just a filter on the widget) works, but creates a lot of extra work.

I think my method could also mess with numbering, if you go there, which might be a bad thing too.

@Ammuayan

I’m not sure I understand exactly where you want those lines but if they are positioned in a “structured way”, e.g "after every last subentry " or some such then this is a spot-on CSS matter. CSS was made for such things.

If you didn’t solve it in a satisfying way yet and if you can specify exactly where you want the lines then I can probably give you a css solution.

They should divide full sections, and should NOT look like just an underline. Not sure how I could define WHICH entry, since that could change as I go. What I’ve done is this, and it looks just as I want it to:

[[Main]]

That image looks like the line has nothing to do with the ToC macro at all - ?

Maybe when you say “a ToC”, you’re referring to some area that you simply call such? It that is the case, you can insert a <hr> wich is the html equivalent to wikitexts ---.

…but I probably misunderstand you.


Add: having now read through the previous thread more closely I’d say, yeah, your actual question doesn’t really have anything specific to do with a ToC or a ToC macro. You just want a line. So, yeah, use --- there’s nothing to it. The discussions about special fields are a red herring.

Oops - just noticed a goof (as I worked my way through the loc field population): in two of the sections, I had tag where it should have been field:loc

Anyway, to your comments.

That image looks like the line has nothing to do with the ToC macro at all - ?

Yep, that’s correct. I didn’t care if it was part of the macro or not - what I wanted is a horizontal rule in the sidebar / table of contents area.

The special field isn’t a red herring. I need that in order to limit which ToCs are created and where - I can’t place a horizontal rule in the middle of the TOC widget.

So what I had to do was create multiple TOCs, separated by HR, and limited with the loc field to ensure that the tiddlers appear in the right section / TOC widget…

I’m using a field because generally, I don’t like the tags. I know I could use CSS to hide them, or several other methods, but I like the field approach here, cause… I just do, I guess. None of the methods I could think of for limiting are really all that distinct, same amount of work, etc. so I just went with my fave.