I figured out how to do a macro for an image text link!

98 views
Skip to first unread message

Suzanne McHale

unread,
Feb 15, 2019, 10:36:31 PM2/15/19
to TiddlyWiki
I am no good at programming, so this took about half-an-hour of repeated typing, saving and frustration in my Tiddlywiki! I just wanted to create a macro for a text link to my images subfolder (rather than embed an image) which I want to do sometimes. I eventually got this to work:

  1. Create a new tiddler and name it (imageTextLink, for example). The only tag for it will be $:/tags/Macro.
  2. The syntax below defines the text that will be linked, the url to be linked to (an image inside an images/ subfolder for my Tiddlywiki) and the image itself.

\define imageTextLink(text,url,image)
<a href="images/$url$">[ext[$text$|images/$url$]]</a>
\end


In a tiddler in which you want the link from, call the macro thus:


Image: <<imageTextLink "Example image" "image-name.jpg">>


Hope that makes sense! I'm just feeling pleased and accomplished (which is a feeling I have rarely) at figuring this out - I could not find any documentation for this on the Tiddlywiki.com site (unless it is hidden somewhere?).

barro...@gmail.com

unread,
Feb 16, 2019, 5:28:38 AM2/16/19
to TiddlyWiki
Excellent!  As I admitted elsewhere, I don't know enough other than make me dangerous, so hopefully more knowledgeable individual will speak up.  But I am looking over your work to see if its an improvement over what I use-- my TW I have a multimedia manager of all my collected work on drive...  (bring them all and in the darkness bind them huh? : ) )

Off hand, another way to do a text link for an image on local drive is use your browser to find the image in a new tab (Firefox does it with a Windows Explorer type interface), right click on image or file and copy link location-- it returns a string like this file:///D:/00/1fkit/xoxo.jpg which in an tiddler acts as a link (to open image in a new tab)

TonyM

unread,
Feb 16, 2019, 6:33:46 AM2/16/19
to TiddlyWiki
Suzanne,

Thanks so much for contributing to the community. You can feeling pleased and accomplished, and contributions are seen by newcomers and experts alike.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages