Tinderbox Forum

Exporting links in text

A couple of questions on export (using v. 8.9.2).

  1. I’m having trouble getting text links to export consistently as links.

    a) When I drag from the Safari address bar into the text pane I get a clickable link. I can control-click and Edit Link… But it doesn’t export as a link.

    When I select text and in the menu Note > Make Web Link I get a link that does export as a link. But I can’t control-click and Edit Link… (not being able to edit doesn’t really matter, but this method of course is less convenient for getting information into TB in exportable form).

    b) When I enter a note-to-note link via Ziplink [[ and [[< both the link and the backlink (if any) export as links. But .html appears in the anchor text even when HTMLExportExtension is set to .md.

    Is this all as intended?

  2. I have Pandoc installed at usr/local/bin. What do I enter in HTMLExportCommand so Tinderbox can find it? have tried:

    usr/local/bin/pandoc -f html -t markdown_mmd

    which works well on my machine from AppleScript, eg:

tell front document of application "Tinderbox 8"
	tell selection 1
		set theHTML to evaluate with "exportedString(this,$HTMLExportTemplate)"
		set pandocScrpt to "usr/local/bin/pandoc -f html -t markdown_mmd"
		set cmdStr to "echo " & quoted form of theHTML & " | " & pandocScrpt
		set theMMD to do shell script cmdStr
	end tell
end tell
set the clipboard to theMMD
return theMMD

But in Tinderbox I get:

`usr/local/bin/pandoc: No such file or directory`

And if I take out the usr/local/bin and just use pandoc …, I get

`pandoc: command not found`

What am I doing wrong?

My test TB file attached (for 1).

Test export links.tbx (96.0 KB)

Try:

/usr/local/bin/pandoc
1 Like

Ah, yes, thanks! AppleScript is more forgiving.

Still struggling with what seems to be inconvenient behavior with exportation of links, per question 1.

1 Like

a) is a known issue, that derives from the fact that ‘smart links’ only exist in the RTF layer of text but are not true Tinderbox (web) links. IOW, you can click/use the links in $Text but you can’t interact with them in Action/Export code as there aren’t defined as true Tinderbox links.

As I recall, the plan (v6?) was that smart links would be detected and adopted as true Tinderbox (web) links. However, the process for doing this proved troublesome as the time and was withdrawn and remains in abeyance. See also: Smart URLs. Meanwhile there is no method to manually ‘adopt’ a smart URL, other than turning off smart quotes, deleting the link and making a Tinderbox Web-type link in its place.

1 Like

I see. Similar issue with the "RTF layer discussed here perhaps? I didn’t draw the connection. Hope @eastgate can address this at some point.

My use case is that I want to do things like have a look at “The East is rising and the West declining” and other related themes in PRC media outlets. One note per theme. But having a separate note for each mention of a theme would quickly overwhelm. So I thought I would just drag in the link when I encountered a mention to a particular theme. Which I can.

But at some point I’ll want to archive the notes to DEVONthink by exporting as individual Markdown files to a folder that DEVONthink can index and that I can also read on iOS, etc., external and note-to-note links intact.

On 1b) I assume the .html extension is not necessarily unintended. Good for .html export, of course, but not for export to Markdown, where internal links in [[filename]] format generally are more useful. I think I’ve found a way to extract that and will post separately.

Perhaps we can find a way to get your reference links into URL attributes. You can then use embedded export code in your text, rather than RTF links. This will be a sure-fire way to have your links export.

The problem is, as understand @mwra to say, there is no easy way to “get at them.” They’re there in the “rtf layer”, and they’re clickable, and you can select, copy to the clipboard, and run an external script to extract them. But at the moment the easiest (only) way seems to be to manually convert them to Web links. That exports fine. But it’s work if there are a lot of them, as I anticipate (too many for it to be practical to have multiple url attributes).

2 Likes

As the anti-pattern (via discussion elsewhere) seems to be a concern that notes with many URLs “if you have a document that contains lots of bare URLs, you suddenly get lots of additional links”. accepting that at face value, I’ve suggested a Boolean $SmartLinks to allow a doc to suppress creation of RTF-only links. This would at least avoid creating unusable links, even if it leaves the user to create Tinderbox web links for those they wish to use. IMO, this seems the sensible compromise for now.

Currently, the inability to stop Tinderbox creating non-Tinderbox links is a pain. A further unneeded annoyance is that Cmd+Opt underlines links that aren’t Tinderbox links but RTF-only.

2 Likes