Here is a little brainstorm of the issues you raise. I hope it helps ![:nerd_face: :nerd_face:](https://talk.tiddlywiki.org/images/emoji/twitter/nerd_face.png?v=10)
There are many ways to do this however given the code you shared there are ways to debug this,
- Such as use
{{$name$!!icon}}
outside the transclude to see if it is returning the value you expect,
- You can also expand your code to use intermediate steps.
-
<$set name=icon-tiddler value={{$name$!!icon}}>
to get the value before you use it.
- With additional intermediate steps its easier to display intermediate values and find out where it is breaking.
- This is true but there are alternative ways to do this, is your key outcome being able to use the icon of the linked tiddler?
- Perhaps a macro just to retrieve the icon?
- Sorry I don’t use the vim plugin
- I see why you may want to place icons automatically in links
[[tiddlername]]
however this is a fundamental part of tiddlywiki and altering that could have unforseen results, and a little complex.
- So I suggest we step back and reconsider your needs
- Search and other methods can find the tiddler title even if used inside transclusions and macros when can be included to complement the backlinks.
Requirements?
- Ability to have internal links include the icon if one exists in the tiddler
- Maintain the backlink functionality when using this solution
Keep in mind we can automate things somewhat with editor toolbar buttons, that wrap each line in a selection with the macro to invoke this.
Have you looked at the freelinks plugin perhaps this could be modified to also display the icon when highlining links for tiddler titles?
Some tips;
- Try and always write macros to make use of the currentTiddler value
\define i() <$transclude tiddler={{!!icon}}/>
<<i>>
<$list filter="[all[tiddlers]has[icon]]">
<<i>><$link/><hr>
</$list>
- in this example what is not obvious is the transclude first gets “transcludes” the tiddler name (from the icon field) then transcludes it.