Ok, I got it working. I forgot my original source was based off of the LinkStyle (
http://linkstyle.tiddlyspot.com), which I had seen in one of Matt's previous email threads. Once I restored the original wrapping widgets, Télumire's SVG-handling code provided the missing piece. After a bit of style tweaking, I got what I was after with this:
\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline html
\define linkstyle()
<$set name="uri" value=<<makedatauri """$(tid)$""" "text/plain">> >
<$list variable="urititle" filter="""[<uri>removeprefix[data:text/plain,]]""">
a[href="#<<urititle>>"]:before{ content: " "; margin-right:.5ch; display: inline-block; height:1em; width:1em; background: center / contain no-repeat var(`--`url); }
<$vars fill="primary">
a[href="#<<urititle>>"]:before{<$vars svg={{!!icon}}>{{||$:/ThemeTweaks/svg/url}}</$vars>}
</$vars>
<$vars fill="primary">
a[href="#<<urititle>>"]:visited:before{<$vars svg={{!!icon}}>{{||$:/ThemeTweaks/svg/url}}</$vars>}
</$vars>
<$vars fill="primary">
a[href="#<<urititle>>"]:hover:before{<$vars svg={{!!icon}}>{{||$:/ThemeTweaks/svg/url}}</$vars>}
</$vars>
</$list>
</$set>
\end
<$list filter="""[has[icon]]""">
<$vars tid={{!!title}}>
<<linkstyle>>
</$vars>
</$list>
I see now that I can use $vars and """$()"""" to pass dynamic arguments to a macro, so that answers my earlier question. I'm still curious if there's a terser way to accomplish this, though.
Here's what it looks like:
Now I can set an "icon" field for a tiddler that points to a SVG, and any link to that tiddler will show that icon in the link. Combined with SVGs I'm pulling in from
https://morosanuae.github.io/tw-icons/ along with a few of my own for smaller libraries that still have logos but aren't published, and I'm where I want to be... for now, at least!
Thanks again for all the help!