I want to link to source code files on my drive. Since usually the path prefix is fixed (where I cloned the code), I wanted a macro so I wouldn’t need to repeatedly type it (well a [source[]] syntax would have been nicer…). I tried to do it with the code below, but TW doesn’t recognize this as an external link and so it is not rendered properly. Note that I want to use ‘source code’ when a label is not provided.
Thanks, I did try to use <a> initially, but then the link was without the tiddlywiki classes, so was not styled. And I couldn’t figure out how to make the $link widget use the values I wanted. It’s not very clear when variables can be used and when filtered transclusion is necessary.
I just want to let you know I have done a lot with formatting file and http paths in all manner of ways and would be happy to share, but in fact this is a large subject area.
First and foremost no custom Javascript needed
One way I have delt with this is to break down a path into its parts so you can follow a link to its constituents paths.
For example if I plugin your path file:///home/ittay/workspace/$path$ into my split-path macro I get this;
Each piece is a link and clicking will open the folder in a browser tab, the icon to the right adds the suffix “/wikibackups” so I can open the backups folder it it is a wiki.
Using this method I simple capture the full path and don’t bother storing the prefix
Have a look at the macro still under development to see how I construct a html element to facilitate this.
I would be happy to build exactly what you want but please spell it out with a little more details, otherwise I have to, in part reverse, engineer your requirements from your unworking code, and it takes more of my time.
After looking at my example above, perhaps your requirements may change?