Easy way to link a string in $Text to the $URL attribute?

I’m wondering, is there any easy way to link a string in $Text, e.g. a company name, to the $URL attribute of a note? For example, I’d love to be able to rt. mouse click on a word or string and select “Link to URL.”

Select the word or phrase. Choose Note ▸ Make Text Link (^⌥⌘-L). A popover will appear to let you enter the URL; if there’s a URL on the system pasteboard, it will be automatically populated.

Hey there, yes, I understand how to link content. But, what if I change the URL in the $URL attribute, then the link won’t update. What I’m looking for is the ability for this link to be in sync with the $URL attribute. I was trying to do this with export templates, which is possible, but then my formatting does not come through the way I want it.

Well, given that—at present—what you initially asked to do is not possible, I’d suggest looking at AppleScript as I don’t believe web links are accessible via action code. I’m not sure if link data is accessible via AppleScript.

Far easier, IMO, is to simply export using $URL incorporated into an HTML link via export code, if necessary caching the anchor text in an attribute to make it accessible. This seems a lot simpler and less prone to breakage (given that the original idea isn’t supported).

Ya, I agree. I can figure something out with export code, no problem. :slight_smile: Thanks.

1 Like

Perhaps, some templates code like:

<a href="^value($URL)^">^value($MyString)^</a>

This could be added before or after $Text in a template or pulled in via an include. I’d parameterise The anchor text to make the code more re-usable. Depending on the $URL value you might need to use urlEncode() as a wrapper for the URL , i.e. ^value(urlEncode($URL))^.

HTH.

1 Like

Kind of an aside, but what’s the best resource to really get started with export code? I’m pretty comfortable inside Tinderbox, but the export functionality is actually preventing me from making more use of it, and that’s just because I haven’t learned it yet. Thanks!

Hey @Jake_Bernstein, great question. Do you have an example of the type of export that you want to do. The key is creating export templates. Exports can be especially useful when you provide conditional code. I’m using them to publish blog, tables and comparisons. Again, if you can share and example of what you’re trying to do, I’d be happy to help.

The essential basics of export are also covered in these example files.

Super simple example, but often times all I want to do is take some notes (and their Text, if any), combine them with a simple delimiter of some kind, and export to something pretty (rendered Markdown, for example).

Speaking of Markdown, I installed MultiMarkdown v6 (just 19 days old) and pointed HTMLPreviewCommand to the multimarkdown processor, but it doesn’t seem to work. Does TBX expect to be given a script rather than a compiled UNIX executable? (Probably a question for @mwra or @eastgate)

Shouldn’t make a difference whether it’s a script of executable. Common mistakes include

  • getting the path to your processor wrong in HTMLPreviewCommand
  • not telling your processor to expect its input on stdin and to write its output to stdout
  • forgetting to mark the processor as executable (and it might need world executable permission; I’m not sure whether HTMLPreviewCommand runs under user or system).

Hmmmm…I’m pretty sure I have the path right because I copied it directly from Finder. The other two issues, however, I’m not sure how to fix. I assume command line switches are used somehow?

Have you tried using Tinderbox’s built-in version of Markdown? I ask as there there several issue to solve here.

Tinderbox essentially has 2 styles of export. One lets folk who just need some styled text get some plain/RTF text. The other richer form, which originally was for HTML but supports all sorts of mark-up, allows much finer control but “some assembly” is required. You want the ‘HTML’ route but using Markdown.

Which version of Markdown is a separate issue. I would first figure out the basic using Tinderbox’s built-in markdown; see here and here. That will let to test the template side of things.

As to the Markdown version, I think @eastgate has covered that in the last-but-one post above.

Hi Jake, per Mark’s note, the using of HTML and export templates can be really effective.

Here is an example of one of my templates for a sales pipeline I manage out of Tinderbox (same concept works for articles, just a different HTML scheme).

This returns a table like this:

To produce this I run an agent that applies the template I want to use. I have different agents and templates for different reports.

Note, the use of conditionals is really nice. :slight_smile:

Yes, I can get the built-in Markdown preview to work fine. I used to use the multimarkdown executable embedded in Scrivener (I don’t know why, but it showed up at some point like that), but I realized it wasn’t working recently. I’m probably fine with standard Markdown, but if I could figure out why the newly installed MMD 6.0 isn’t working, that’d be best.

1 Like

OK. I’ve no real experience with the MMD so sadly I can’t help much with that but hopefully others can.

First: open terminal, and try running your HTMLPreviewCommand there. For example:

cat test.md | /Path/To/MyCommand.py

This takes a file test.md and sends it to your Markdown processor. Does this work as you expect? That will let us separate issues with the script from other issues.

I’m a mega-doofus. I had HTMLMarkupText checked and not HTMLMarkdown. :man_facepalming: Now on to learning HTML export!

1 Like