TOC-macros Rewritten (+ a lot of new fuctionality) - Part 2

Just published a new version. Latest version is linked in the OP. OP docs is up to date

CTRL-click Chevron Expands / Folds Tree Branches

  • CTRL-clicking on a chevron should expand the whole tree
  • CTRL-click again will close the whole tree again

Advantage: If everything is expanded, a “normal” click only fold the “current” branch and leaves “sub-branches” alone

The JSON attachment contains some test-* tiddlers that I use for testing atm. They are chaotic, but contain a bit of info and some links

  • blue links are standard
  • green links are toc-included
  • dark violet is toc-filtered

toc-macros-new-test-tiddlers.json (28.0 KB)

have fun!
-mario

4 Likes

I just revisited this topic @pmario due to link you shared and it is very exciting. I have not yet tested comprehensively but will soon.

How likely is it to be in the next release and can I help any other way?

The preview edition contains a lot of test tiddlers but the documentation examples are still missing.

According to the comment from Jeremy at GH Work In Progress - Toc v5.3.x rewrite by pmario · Pull Request #7961 · Jermolene/TiddlyWiki5 · GitHub the code docs also needs some work.

In the code I did add comments, where they are needed to maintain the code. There should be no user docs. It’s developer docs only.

Not sure what you mean here, do you mean adding the content at the top of this thread and the GitHub change Work In Progress - Toc v5.3.x rewrite by pmario · Pull Request #7961 · Jermolene/TiddlyWiki5 · GitHub is sufficient to add below the current TOC Table-of-Contents Macros - tiddler?

Jeremy was not happy with the comments in the middle of the code. From my point view, they only make sense, if you really dig into the code. I did add comments, where I did need them, so the code made sense for me after about 3 weeks of not coding.

The “start” of the user documentation is the OP here in the thread. It’s a wiki, so everyone can extend it.

A lot of the background about the new functionality can be found in part 1: Proposal: TOC-macros Rewrite using IF, Functions and Procedures (+new fuctionality)

Mario.

The following occured to me, and I appreciate it must most likely remain out of scope, but given the inclusion of the parent field, I was wondering what if we were looking at bibliographical trees and there were two or more parents?

  • Perhaps we could use two parent fields and two tocs like patralinial and matralinial.

I just wonder if now or later we can supprt this?

Given the value to many of recording family trees.

The OT has just been updated, with a cross-post from: Optimal TOC use for multiple topics? - #18 by pmario

1 Like

a bit of a late question but, hoa difficult would it be to create a button in the toc tree that is just a ‘new-here’ button? maybe a plus icon to the right of hovered nodes and would tag the new tiddler with the hovered node?

juat curious, it’s one of those little features ive noticed was pretty handy in onenote.

My tocP-plugin does that so it should be relatively straight forward to add it to this macro too. I’ll have to have a closer look. But I’m not sure when.

3 Likes

@Justin_H – TaDaaa :tada:

There will a tv-toc-show-new-child variable now, that allows us to switch this feature on and off.
tocP – parent based TOCs will have a different icon.

The new version should be active soon.

4 Likes

Nice!

The toc macro is really getting a face-lift, and turning into something epic

Will we be able to apply css to it? Something along the lines of :hover {display:inline} and not hover is hidden?

Edit: I meant to come back to this but unfortunately things got quite hectic, but to follow up with my question, I poked around a bit and created a stylesheet that achieves what I was curious about!

I will say that giving the new-child buttons a css class would be a bit more practical but all things considered there is no issue with how it is set up, and I’m sure it is moreso a temporary setting!

But, that being said, here is the CSS needed to show the buttons only when the tiddlers are hover overed, to avoid any sort of visual clutter when navigating the TOCs ^^

li.toc-item .tc-tiddlylink.tc-tiddlylink-resolves .tc-small-gap-left button {
display: none;
}

li.toc-item .tc-tiddlylink.tc-tiddlylink-resolves:hover .tc-small-gap-left button {
display: inline-block;
}

And, just want to say again that I think these changes are an amazing improvement to an otherwise already vital part of TiddlyWiki.

Edit 2:

Having a bit of a difficult time trying to import the plugin to a blank tiddler for testing. Unfortunately I am unable to get it working correctly outside of the linked v5.3.6 link. Is there a dependency on features found in the pre-release?

Just asking to see if there is a way I can use it for my wiki, as I really like how the TOC in the linked TW has turned out.

1 Like

I will say that giving the new-child buttons a css class would be a bit more practical but all things considered there is no issue with how it is set up, and I’m sure it is moreso a temporary setting!

I did just add 4 new classes

  • tc-toc-new-child to the wrapper SPAN
  • tc-toc-new-child-tag to the “new here” button - default
  • tc-toc-new-child-parent to the “new child” button - tocP like
  • tc-toc-new-child-tagLike to the “new here” button - tagLike

Having a bit of a difficult time trying to import the plugin to a blank tiddler for testing. Unfortunately I am unable to get it working correctly outside of the linked v5.3.6 link. Is there a dependency on features found in the pre-release?

There should be no extra dependency.

Latest preview can be found at: https://deploy-preview-7961--tiddlywiki-previews.netlify.app/

2 Likes

5 posts were split to a new topic: Issue with: TOC-macros Rewritten

Question regarding the toc-itemTemplate.

Does this apply to the tocp WIP plugin, and will modifying it allow for additional buttons to appear for the TOC nodes, such as a ‘new journal here’ button next to the new-here button?

that could be achieved through the item template but consider hiding it, perhaps ctrl click for new here on any titile or only those with a custom item template. buttons can be made to look like title links.

Hi Tones, I’m not sure I follow the suggestion your making.

I do use some custom CSS to hide the nodes ‘new-here’ button unless hovering the link within the TOC with my cursor, but are you suggesting not having an additional button next to it and instead adding CTRL + MOUSE1 action to the existing button to create a new-journal tiddler from it?

I was thinking either a way to use a list field to choose which buttons appear if it wasn’t the toc-itemTemplate, but I’m interested in your suggestion

For reference:
{769189F5-1D46-4583-BE94-0C144625AAE5}

1 Like

Thta good, I dont know css as much to do that. Although I could work it out.

I was - but in this case the title link will be a button that looks like a link, and yes ctrl-Click to create new here on any title.

Yes, you could make a toolbar to add to each title, But how many different buttons would you want?

  • new Here
  • Open in editor
  • Copy to clipboad
  • not many more come to mind

So they all could use a modifier key

Always allow the title to be dragged and dropped. I have an alternate tags bar that allows me to drop titles on to tag so you can tag tiddlers in the story with anything in the contents etc…

Oh just right now would be the new-journal-here button, but I imagine later on other buttons like “new-event-here” or “new-task-here” comes to mind :grin:

You could design the new here to create the appropriate tiddler, eg new hear on a tiddler called Events would create an event (only) this is possible with the TOC enhancements because you can customise the template on individual tiddlers.