Here’s a simple AppleScript which can be used with a TextExpander snippet, or as a Service via the macOS Automator app, that when invoked will insert the title and URL of the frontmost Safari tab, formatted as a Markdown link.
tell application "Safari" set theURL to URL of front document set theName to name of front document end tell get "[" & theName & "](" & theURL & ")"
I set up the TextExpander shortcut mdL for this. Be sure to set the snippet as an AppleScript snippet for this to work properly.
Now, when I find a link I want to save, I just switch over to nvALT as per usual, get the cursor where I want it, and invoke the snippet.
My old method was to use a Safari bookmarklet, which I had to click, then Copy, Esc the dialog, switch to t nvALT, Paste.
So much simpler now.
If you’d like to have some control over the link text before the Markdown link is inserted, head over to Dr. Drang’s Markdown & TextExpander post which helped me formulate this snippet.
I set up Drang’s snippet as a companion, for those intermittent times when I want to modify the text prior to insertion.
Been wanting to add this to my setup for some time. Glad it was pretty straightforward.