Any chance we'd get a cascade for wikilinks?

I have been looking for ways to modify [[wikilinks]] in various ways based on the linked tiddler’s tags, such as styling them or prefixing an icon before the link. Right now, most of what I want to do can only be done by modifying prettylinks.js. But I was wondering, before I start meddling with prettylinks.js, has any work been done in creating a cascade for wikilinks? This would make modifying links a lot easier (and potentially safer) than modifying a piece of javascript code.

Welcome @intrinsical,

Perhaps @jeremyruston would be a good one to answer this?

Recently I learned more on this;

Including for missing tiddlers, which completes the circle. I have already come to the idea of building a cascade for that.

  • Here is the next big step in this endeavour Exploring default tiddler links hackability in V5.3.0
    However the “low hanging fruit” is to build a macro or template, perhaps with a custom Editor Toolbar button to assist, and design the “link as you desire”; For example <<link-macro "link or tiddler title">> or {{link or tiddler title||link-template}} and you can freely design your link-macro or link-template to do all you dream of.
  • Within your design you could introduce a cascade for such links.
  • The advantage here is you nominate which links these apply to

In time I will share more but my approach includes;

  • Do everything to avoid a core change
  • If a core change is necessary ask for a minimalist one which empowers hackability whist minimising complexity.
  • Until you have a core change or overwrites. invest in good macro or template design, because they can be used once a core hack is found.

Ultimately what you ask for can be very empowering but it also “fiddles with the fundamentals” and thus needs a higher level of rigor than other changes.

  • Most of the current link handling was developed in early TiddlyWiki, the cascades are fairly recent.
  • A lot of parts use links so if adding features you can get unexpected outcomes. Macros and transclusion templates are more targeted, used when needed, and thus do not have as many unexpected outcomes.

Conclusion

So look around, a lot of people have developed solutions that change link behaviour from popup previews to extra functionality (without JavaScript of any kind). Macros and templates work well and their use can be simplified with custom Editor toolbar buttons.

Perhaps search and ask for the actual solutions to ;

Check out:

Here is some more CSS to play around with:

<$list filter="[has[linkcolor]]">
   <div>
   a.tc-tiddlylink[href$="{{{ [<currentTiddler>encodeuri[]] }}}"] { color:{{{ [<currentTiddler>get[linkcolor]] }}}; }
   </div>
</$list>



<$list filter="[prefix[Test ]first[]splitbefore[ ]encodeuri[]addprefix[#]]">
   <div>
   a.tc-tiddlylink[href^="{{{ [<currentTiddler>] }}}"]::before { content:"\2B50"; }
   </div>
</$list>

Fyi, I’m asking for this because I’m considering building the next iteration of my D&D5e wiki. My personal version of the wiki currently has close to 10k tiddlers, is 18mb in size and I estimate at least 75-80% of the tiddlers have wikilinks that I would like to simplify.

My personal copy of the wiki uses a mix of both {{Link||link-template}} transclusions as well as about a hundred link macros. For the next version, I’d like to simplify most of these tiddlers to just use [[links]] where possible and have TW5 automatically render them differently based on the tags each link has.

Do everything to avoid a core change. If a core change is necessary ask for a minimalist one which empowers hackability whist minimising complexity.

Yup, I totally agree with this. I have looked at prettylinks.js. While I know I can safely modify it without issues, I also know I should not do that except as a last resort. Its a huge wiki and I am very concerned about potential performance issues.

That’s why I’m asking if link cascades would be implemented anytime soon. If it is going to be added to some near-term future version of TW, then I’d happily wait for that version to be released rather than waste time personally hacking TW’s core.

In the next major release of TW (v5.3.0) that is expected to be released this summer you will be able to override the link widget via wikitext and replace it with your own custom rendering and behaviour, via a custom widget defined in wikitext.

1 Like

I guess I’ll wait. Thanks for all the hard work you guys put into TW!