TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
7.99k stars 1.18k forks source link

[IDEA] square bracket field transclusion #6780

Open justin-hurd opened 2 years ago

justin-hurd commented 2 years ago

I'm not sure how to word it, but the ability to link to a tiddler while using the value of a specific field to name it, ie.

[[GettingStarted!!caption]] where the caption field would be "Hello"

Alternatives to this is [[Hello|GettingStarted]] but in doing this, the user has to manually decide what they want to name the link, which could be mispelled if it's something more complex.

twMat commented 2 years ago

@justin-hurd - I think what you want is <$link to={{GettingStarted!!caption}} /> or perhaps {{{ [[GettingStarted]get[caption]] }}}.

justin-hurd commented 2 years ago

@twMat Not quite, the result for both of those is a missing link to hello, rather than a link to GettingStarted.

in plain HTML with Wikitext it would look something like, "<a href="#GettingStarted">{{GettingStarted!!caption}}</a>" though this only works the first time you click the link, I imagine I did it partially incorrect but it should work the first time to get an example.

The reason I suggest the shortened wikitext of [[Tiddler!!Field]] is incase you're typing about someone and don't remember their name spelling, and have it abbriviated, or maybe they have special characters in their name, etc, just as an addendum to my previous reasoning.

Edit: however, what you recommended would be useful for making quick links in relation to the tiddler. something like <$link to={{JohnDoe!!sister}} /> could have some utility too. maybe having it's own syntax would also be beneficial. I will save that for a different feature request, but I would consider something like [[JohnDoe//sister]]

kookma commented 2 years ago

A linkify macro has been discussed in forum and also is part of Utility plugin.

See the small macro here: https://talk.tiddlywiki.org/t/link-to-tiddler-by-any-field/588

justin-hurd commented 2 years ago

I was aware of PMario's plugin, but was unaware of the thread. This is functionally the same as what I had in mind. I suppose since you can create it as a macro, having it added as extended functionality to the already existing wikitext syntax would be ill advised?

If so, where could I find the core tiddler(s) responsible for double square bracket wikitext? I would like to create this as a personal utility just for learning and entertainment.