These are the TextExpander snippets I use to create Markdown links. I almost always create reference links with implicit link names instead of inline references, so all of these, except the last, support that style.
Create an inline link with implicit link name
As basic as it gets. Create an implicit link with the cursor positioned within the link name.
Content Type: Plain text
Snippet Content:
[%|][]
Abbreviation: md[
Create an inline link with implicit link name from the title of the frontmost Safari document
Content Type: AppleScript
Snippet Content:
tell application "Safari" to set theTitle to name of front document
set markdown_string to "[" & theTitle & "][]”
Abbreviation: mdim
Example:
If Daring Fireball was the frontmost document in Safari, this would generate:
[Daring Fireball][]
Create a link definition from the title and URL of the frontmost Safari document
I use this in conjunction with the snippet above. I use this to automatically generate the implicit link definition.
Content Type: AppleScript
Snippet Content:
tell application "Safari"
set theTitle to name of front document
set theURL to URL of front document
end tell
set markdown_string to "[" & theTitle & "]:" & theURL
Abbreviation: mddef
Example:
If Daring Fireball was the frontmost document in Safari, this would generate:
[Daring Fireball]:http://daringfireball.net/
Create an inline link with implicit link name from the clipboard
Content Type: Plain text
Snippet Content:
[%|][]
Abbreviation: mdc
Example:
If "John Gruber's Website" was copied to the clipboard, this would generate:
[John Gruber's website][]
New implicit link definition with implicit link name from the clipboard
I use this one when I have text of the reference in the clipboard, but I want to manually enter the URL. Cursor is positioned after the colon.
Content Type: Plain text
Snippet Content:
[%clipboard]:%|
Abbreviation: mddeft
Example:
If "John Gruber's Website" was copied to the clipboard, this would generate:
[John Gruber's Website]:
Create a link definition with the title from the clipboard and the URL of the frontmost Safari document
I use this when I have written a custom link name to the frontmost Safari website. Once I write the link name, I copy it to the clipboard, and then use this snippet to generate the link definition.
Content Type: AppleScript
Snippet Content:
set theTitle to the contents of (the clipboard)
tell application "Safari" to set theURL to URL of front document
set markdown_string to "[" & theTitle & "]:" & theURL
Abbreviation: mddec
Example:
If "John Gruber's website" was copied to the clipboard and Daring Fireball was the frontmost document in Safari, this would generate:
[John Gruber's website]:http://daringfireball.net/
Create a link definition with no title and the URL of the frontmost Safari document
This is a variation of the above. It pulls the URL from Safari, but leaves a blank link name. I might use this if I'm creating the reference URL before putting the reference in the document or if I haven't copied the link name to the clipboard.
Content Type: AppleScript
Snippet Content:
set theTitle to the contents of (the clipboard)
tell application "Safari" to set theURL to URL of front document
set markdown_string to "[]:" & theURL
Abbreviation: mddeb
Example:
If Daring Fireball was the frontmost document in Safari this would generate:
[]:http://daringfireball.net/
Create an inline reference with the title of the frontmost Safari document
This is the only snippet I've included that uses the inline style, so if you use this style it is pretty helpful.
Content Type: AppleScript
Snippet Content:
tell application "Safari"
set theTitle to name of front document
set theURL to URL of front document
end tell
set markdown_string to "[" & theTitle & "](" & theURL & ")"
Abbreviation: mdin
Example:
If Daring Fireball was the frontmost document in Safari this would generate:
[Daring Fireball](http://daringfireball.net/)