[question] plugin that turn a transclusion into a clickable link in edit mode ?

183 views
Skip to first unread message

Télumire

unread,
Jun 10, 2021, 7:33:53 PMJun 10
to TiddlyWiki
Hello everyone!

Does anyone know if there is a plugin that turn a transclusion into a clickable link to the tiddler transcluded, in edit mode?

The process would be as follows:

I want to edit a tiddler (A). When the editor opens, I see that I have transcluded another tiddler (e.g. {{B}}) inside the tiddler A.

I want to edit what is in B, so rather than copy/paste the title of tiddler B into the search bar, click on the relevant tiddler in the search result, then edit the tiddler B, this plugin would allow me to simply click on {{B}}, which open the tiddler B, ideally already in edit mode. This would save a lot of time !

CodeMirror is able to parse links, so maybe someone made an addon build upon it allowing this functionnality ? I searched but ultimately found nothing ..

PS : I know that it's possible to use a macro instead of a standard transclusion (like discussed here https://tiddlywiki.narkive.com/dxOiR2Vn/tw-tw5-including-a-link-when-transcluding) but I dont want to change the way the tiddler is displayed in view mode.


Frédéric Demers

unread,
Jun 10, 2021, 11:28:37 PMJun 10
to TiddlyWiki
Not exactly what you want but if you use the paragraphs plugin to transclude, you can edit the original tiddler's text directly when in view more. You may be able to tweak it so the view is nearly identical.

Ste

unread,
Jun 11, 2021, 9:51:59 AMJun 11
to TiddlyWiki
I think there is something in tbeers repository of stuff that does that, though you have to use a slightly different syntax to {{}}  for it to work.

Though having just looked I can't spot it....

TW Tones

unread,
Jun 12, 2021, 9:57:34 AMJun 12
to TiddlyWiki
Folks,

There is a way to always transclude via another transclusion eg;

{{transcludetiddler||transclude}} where "transclude" is a smart tiddler that responds to an edit mode setting, if in edit mode it will allow editing, provide a link etc,, other wise behave as normal. In the transclude tiddler the tiddler to transclude will be <<currentTiddler>> and if you must get the tiddler it displayed in (would normally be the current tiddler)  use <<storyTiddler>>.

Regards
Tones

si

unread,
Jun 12, 2021, 2:22:24 PMJun 12
to TiddlyWiki
>>> CodeMirror is able to parse links, so maybe someone made an addon build upon it allowing this functionnality ? I searched but ultimately found nothing ..

I'm not aware of any currently existing plugin, but CodeMirrorPlus has an open ticket for adding clickable links in edit mode: https://github.com/adithya-badidey/TW5-codemirror-plus/issues/6

Télumire

unread,
Jun 12, 2021, 6:39:54 PMJun 12
to TiddlyWiki
Hello everyone,

First of all thank you very much for taking the time to answer me, second of all my apologies for answering so late.

Fred,  for now instead of a macro I proceed as follow (online demo here) :

In the tiddler transcluded I want to make editable,  I put {{||edit}} at the end of the tiddler.
The tiddler edit contains the following code :

<span class="hide-until-hover"> {{||$:/core/ui/Buttons/edit}} </span>

And with a bit of CSS magic I got what I want, except it's not automatic of course and it doesnt work in edit mode.
I think I will follow your advice and repurpose the paragraph macro, this seems like the easiest workaround.

Ste, I think you are refering to this : https://tobibeer.github.io/tw5-plugins/#inc-Examples , this is a great macro however it only work in view mode. My workaround is worse tho, so until I find something better I think I'll use his plugin.

Tones, this is a great suggestion and IMO is better than a macro, while being also limited to the view mode. I tried to follow your explanation and got this : https://frontenddevweb.github.io/#:[tag[TW%20Tones]]
Is that what you had in mind ?

si, I stumbled upon it as well yesterday, this is great ! That would be perfect. This ticket was made a year ago however so I really hope the author will eventually add it.

Once again, thanks you all for your help.

Saq Imtiaz

unread,
Jun 13, 2021, 1:58:21 PMJun 13
to TiddlyWiki
@si @Telumire

Here is a very simplistic, quick and rough proof of concept for adding some helpful popups in codemirror:
(Needs current pre-release of TW)

Try ctrl+click on different parts of tiddler links and transclusions.
The popup itself is entirely wikitext based so can be easily customized.

Screenshot 2021-06-13 195609.png

Screenshot 2021-06-13 195705.png

Note that cmplus does not distinguish between simple transclusions, transclusions with templates and filtered templates. While you can work around this in wikitext, adding support in cmplus would make life a lot easier.

Another approach would be to embed clickable elements in the editor next to links and transclusions. Rapid tiddler uses this approach so if someone wants to take that route, the code pattern there is probably helpful for follow:

Cheers,
Saq

Télumire

unread,
Jun 16, 2021, 8:48:13 AMJun 16
to TiddlyWiki
Hello Saq,

This is exactly what I wanted, thank you so much !

Since TW 5.2.0 is around the corner (?) I will wait a bit to upgrade my wiki, but your demo is perfect for my needs :)

In my opinion, from a UX POV it's best to use a popup, or even better no popup at all (just click on the link to open the tiddler, maybe with an underline and a cursor:pointer when hovering the link to keep consistency) to avoid cluttering in the editor.
This is because if the user want to use emojis, the icons could get confusing.

Great work !
Reply all
Reply to author
Forward
0 new messages