Patrick Rhone (from MinimalMac) did his first screencast this week about creating a Text Expander snippet for Markdown links. Like Patrick, I write everything in Markdown (although I use the MultiMarkdown
variant), which lets me export to nearly any format and write on the iPhone, iPad, and Mac without friction. I wrote the whole book in MultiMarkdown.*
Anyway, Patrick’s video got me thinking. Patrick puts his links right next to the linked words. I use Markdown’s reference links. The advantage of using referenced links is that the text is much easier to read. You can also use the same reference more than once. Reference links can be set anywhere in the document. Some folks do it at the end of the paragraph. I do them all at the bottom.
The syntax for reference links in Markdown works as follows:
First you type some [Link Text][Reference]
Then more text … yadda yadda yadda
[Reference]:Web URL
The Link Text is the text that shows up on the page. The Reference is an index. It can be a number or words. The Web URL is the link you are pointing toward. Here is concrete example.
This is one [nerdy Mac site.][1]
Really, the guy just won’t shut up.
[1]:https://www.macsparky.com/
So I decided to take a page from Patrick’s playbook and create my own TextExpander snippet to create referenced links. It’s not that hard.
Snippet Walkthrough
If you are thinking ahead while you write, you can do this all in one step. This snippet, upon activation, asks you to insert the Link Text and Reference and then creates a Reference entry on the next line using the Web link from your clipboard. Finally, it puts the cursor back at the end of your link text. Fire up TextExpander and follow along.
Create a new snippet and start with two sets of brackets. The first will hold the Link Text and the second will hold the Reference. The Snippet should now look like this:
— Begin Snippet Code —
[][]
— End Snippet Code —
Next, create a Fill-In blank for the Link Text. These are blanks that Text Expander will prompt you to fill when the snippet runs. To create a Fill-In blank, insert the cursor between the first two brackets and select Fill-In from the Cursor drop down shown below.
— Begin Snippet Code —
[%fill:name%][]
— End Snippet Code —
Next, create a second Fill-In blank in the second set of brackets. This will be the blank for the Reference. When you create this second FIll-In blank, change the text from fill:name
to fill:reference
. This name is a variable. If you use the same name twice, TextExpander will copy it into both places. You will use this later.
— Begin Snippet Code —
[%fill:name%][%fill:reference%]
— End Snippet Code —
Next you’ll create the reference. First add a few carriage returns and then create the reference syntax, which is a pair of brackets and a colon.
— Begin Snippet Code —
[%fill:name%][%fill:reference%]
[]:
— End Snippet Code —
Add a Fill-In blank in the brackets and rename it fill:reference
. This duplicates the reference used above so you only need to type it once.
— Begin Snippet Code —
[%fill:name%][%fill:reference%]
[%fill:reference%]:
— End Snippet Code —
Next, add the Web URL. Place the cursor after the colon and select the Clipboard option from the cursor drop down shown in the figure below. This step dumps your clipboard in as a link. In order to make this work, you must first select and copy the link you want to use before activating the snippet. (You can do this in Safari by navigating to the desired page, pressing Command-L and then Command-C.) Alternatively, you could also make this a Fill-In field and type the URL in manually.
— Begin Snippet Code —
[%fill:name%][%fill:reference%]
[%fill:reference%]:%clipboard
— End Snippet Code —
Finally, move the cursor back to the top line at the end of the link and select Position Cursor Here from the Cursor menu. This resets the cursor back in your text so you can continue typing.
— Begin Snippet Code —
[%fill:name%][%fill:reference%] %|
[%fill:reference%]:%clipboard
— End Snippet Code —
I named this snippet Markdown Link and use the keyboard combination .[
to set it off.
Here is a picture of it in action.
And here is the resulting code.
Link as Afterthought
The above workflow assumes you think of creating the link while you are typing. If you want to add a reference link later, I created two more snippets.
The first takes highlighted text in the body of your text and sets up the text and reference number. Here is the TextExpander snippet code. I use .]
to activate this snippet.
— Begin Snippet Code —
[%clipboard][%fill:reference%]
— End Snippet Code —
The second snippet creates the reference link. I use .:
for this one.
— Begin Snippet Code —
[%fill:reference%]:%clipboard
— End Snippet Code —
Are you a Markdown nerd and using TextExpander? Let me know or, better yet, leave a comment and describe it for everyone.
- I realize this post is putting the cart before the horse. I’ll be writing and speaking more about the how and why of MultiMarkdown soon. We are also planning a Mac Power Users episode around it. In the meantime, you can read John Gruber’s Markdown syntax guide, Fletcher Penny’s MultiMarkdown syntax guide, Practical Efficiency’s Markdown posts, and, of course, Patrick’s video.
That is some serious geekiness. Whoah.
That is some serious geekiness. Whoah.
That is some serious geekiness. Whoah.
That is some serious geekiness. Whoah.
That is some serious geekiness. Whoah.
Beginner here,
Do you have to learn HTML before learning markdown?
Where's a good place to start learning markdown?
Thank you.
Beginner here,
Do you have to learn HTML before learning markdown?
Where's a good place to start learning markdown?
Thank you.
Beginner here,
Do you have to learn HTML before learning markdown?
Where's a good place to start learning markdown?
Thank you.
Beginner here,
Do you have to learn HTML before learning markdown?
Where's a good place to start learning markdown?
Thank you.
Beginner here,
Do you have to learn HTML before learning markdown?
Where's a good place to start learning markdown?
Thank you.
I did similar things with TextMate snippets a few years ago. Two snippets are very like yours, and another grabs Google's "I Feel Lucky" link for the selected text.
The advantage of your snippets, of course, is that they're not tied to a particular text editor. This is a considerable advantage for people who hop from editor to editor.
The advantages of my snippets are
* they put the reference links down at the bottom of the document; and
* they keep track of the reference numbers and fill them in for you (you can edit them if you like).
I'm pretty sure it's impossible for a TextExpander snippet to do these things because TE doesn't have access to the file contents or the editor internals.
My snippets *don't* assume the URL to be on the clipboard, mainly because I have other snippets (written in TE) that grab URLs for me.
I did similar things with TextMate snippets a few years ago. Two snippets are very like yours, and another grabs Google's "I Feel Lucky" link for the selected text.
The advantage of your snippets, of course, is that they're not tied to a particular text editor. This is a considerable advantage for people who hop from editor to editor.
The advantages of my snippets are
* they put the reference links down at the bottom of the document; and
* they keep track of the reference numbers and fill them in for you (you can edit them if you like).
I'm pretty sure it's impossible for a TextExpander snippet to do these things because TE doesn't have access to the file contents or the editor internals.
My snippets *don't* assume the URL to be on the clipboard, mainly because I have other snippets (written in TE) that grab URLs for me.
I did similar things with TextMate snippets a few years ago. Two snippets are very like yours, and another grabs Google's "I Feel Lucky" link for the selected text.
The advantage of your snippets, of course, is that they're not tied to a particular text editor. This is a considerable advantage for people who hop from editor to editor.
The advantages of my snippets are
* they put the reference links down at the bottom of the document; and
* they keep track of the reference numbers and fill them in for you (you can edit them if you like).
I'm pretty sure it's impossible for a TextExpander snippet to do these things because TE doesn't have access to the file contents or the editor internals.
My snippets *don't* assume the URL to be on the clipboard, mainly because I have other snippets (written in TE) that grab URLs for me.
I did similar things with TextMate snippets a few years ago. Two snippets are very like yours, and another grabs Google's "I Feel Lucky" link for the selected text.
The advantage of your snippets, of course, is that they're not tied to a particular text editor. This is a considerable advantage for people who hop from editor to editor.
The advantages of my snippets are
* they put the reference links down at the bottom of the document; and
* they keep track of the reference numbers and fill them in for you (you can edit them if you like).
I'm pretty sure it's impossible for a TextExpander snippet to do these things because TE doesn't have access to the file contents or the editor internals.
My snippets *don't* assume the URL to be on the clipboard, mainly because I have other snippets (written in TE) that grab URLs for me.
I did similar things with TextMate snippets a few years ago. Two snippets are very like yours, and another grabs Google's "I Feel Lucky" link for the selected text.
The advantage of your snippets, of course, is that they're not tied to a particular text editor. This is a considerable advantage for people who hop from editor to editor.
The advantages of my snippets are
* they put the reference links down at the bottom of the document; and
* they keep track of the reference numbers and fill them in for you (you can edit them if you like).
I'm pretty sure it's impossible for a TextExpander snippet to do these things because TE doesn't have access to the file contents or the editor internals.
My snippets *don't* assume the URL to be on the clipboard, mainly because I have other snippets (written in TE) that grab URLs for me.
David, I think it's very cool that you wrote your entire Mac at Work book in MultiMarkdown. That's a true testament to the power of plain text writing.
Awesome post. I could read about MultiMarkdown + TextExpander workflows all day.
David, I think it's very cool that you wrote your entire Mac at Work book in MultiMarkdown. That's a true testament to the power of plain text writing.
Awesome post. I could read about MultiMarkdown + TextExpander workflows all day.
David, I think it's very cool that you wrote your entire Mac at Work book in MultiMarkdown. That's a true testament to the power of plain text writing.
Awesome post. I could read about MultiMarkdown + TextExpander workflows all day.
David, I think it's very cool that you wrote your entire Mac at Work book in MultiMarkdown. That's a true testament to the power of plain text writing.
Awesome post. I could read about MultiMarkdown + TextExpander workflows all day.
David, I think it's very cool that you wrote your entire Mac at Work book in MultiMarkdown. That's a true testament to the power of plain text writing.
Awesome post. I could read about MultiMarkdown + TextExpander workflows all day.
I got Patrick's to work just fine, but every time I try these, the window defocuses and nothing happens.
I got Patrick's to work just fine, but every time I try these, the window defocuses and nothing happens.
I got Patrick's to work just fine, but every time I try these, the window defocuses and nothing happens.
I got Patrick's to work just fine, but every time I try these, the window defocuses and nothing happens.
I got Patrick's to work just fine, but every time I try these, the window defocuses and nothing happens.
For Markdown on the iPad then you should look at Edito which is a simple application designed for markdown.
Like in Simple Note you just write in your text but the advantage with Edito is the extra row of keys you get on the keyboard. Instead of having to use loads of clicks to get the symbol you want like the hash symbol #, the asterisk * etc you can do it with one click.
Easy….
For Markdown on the iPad then you should look at Edito which is a simple application designed for markdown.
Like in Simple Note you just write in your text but the advantage with Edito is the extra row of keys you get on the keyboard. Instead of having to use loads of clicks to get the symbol you want like the hash symbol #, the asterisk * etc you can do it with one click.
Easy….
For Markdown on the iPad then you should look at Edito which is a simple application designed for markdown.
Like in Simple Note you just write in your text but the advantage with Edito is the extra row of keys you get on the keyboard. Instead of having to use loads of clicks to get the symbol you want like the hash symbol #, the asterisk * etc you can do it with one click.
Easy….
For Markdown on the iPad then you should look at Edito which is a simple application designed for markdown.
Like in Simple Note you just write in your text but the advantage with Edito is the extra row of keys you get on the keyboard. Instead of having to use loads of clicks to get the symbol you want like the hash symbol #, the asterisk * etc you can do it with one click.
Easy….
For Markdown on the iPad then you should look at Edito which is a simple application designed for markdown.
Like in Simple Note you just write in your text but the advantage with Edito is the extra row of keys you get on the keyboard. Instead of having to use loads of clicks to get the symbol you want like the hash symbol #, the asterisk * etc you can do it with one click.
Easy….
Elements is a much better text editor, even without special Markdown keys and doesn't look terrible like Edito.
Brandon
Have you seen how awkward it is to get the markdown characters if you don't have the extra keys ??
I know beauty is in the eye of the beholder but no reason to let it make you blind to more important things. On top of that – Have you seen the price of Elements, a bit pricey for a text editor however sexy looking it is.
Edito is not terrible looking and does the job of being a text editor for Markdown well.
We will have to agree to disagree I think !
Mac20Q
Brandon
Have you seen how awkward it is to get the markdown characters if you don't have the extra keys ??
I know beauty is in the eye of the beholder but no reason to let it make you blind to more important things. On top of that – Have you seen the price of Elements, a bit pricey for a text editor however sexy looking it is.
Edito is not terrible looking and does the job of being a text editor for Markdown well.
We will have to agree to disagree I think !
Mac20Q
Brandon
Have you seen how awkward it is to get the markdown characters if you don't have the extra keys ??
I know beauty is in the eye of the beholder but no reason to let it make you blind to more important things. On top of that – Have you seen the price of Elements, a bit pricey for a text editor however sexy looking it is.
Edito is not terrible looking and does the job of being a text editor for Markdown well.
We will have to agree to disagree I think !
Mac20Q
Brandon
Have you seen how awkward it is to get the markdown characters if you don't have the extra keys ??
I know beauty is in the eye of the beholder but no reason to let it make you blind to more important things. On top of that – Have you seen the price of Elements, a bit pricey for a text editor however sexy looking it is.
Edito is not terrible looking and does the job of being a text editor for Markdown well.
We will have to agree to disagree I think !
Mac20Q
Brandon
Have you seen how awkward it is to get the markdown characters if you don't have the extra keys ??
I know beauty is in the eye of the beholder but no reason to let it make you blind to more important things. On top of that – Have you seen the price of Elements, a bit pricey for a text editor however sexy looking it is.
Edito is not terrible looking and does the job of being a text editor for Markdown well.
We will have to agree to disagree I think !
Mac20Q
I'll give you that the extra row of keys is nice; iA writer does something similar too. But I already have TextExpander snippets set up for my most used Markdown bits and I cannot bring myself to use (let alone pay for) a text editor that throws away screen real estate for the sake of a decorative frame. I'm not sure what's so awful about Elements' price either. Both Edito and Elements are $4.99 and Elements is a universal app. Elements lacks HTML export, but it has a Markdown preview and supports opening up Markdown source files from other iOS apps. Elements also has a handy scratchpad for storing bits of text that you can copy to and from while working on your main body of text. Lastly, Elements was the first iOS text editor to support Dropbox syncing. Secondgear Software also makes MarkdownMail if you want to email HTML which was the first Markdown-supporting iOS app in the App Store. It's an additional $3.99, but once again, it's a universal app.
I'll give you that the extra row of keys is nice; iA writer does something similar too. But I already have TextExpander snippets set up for my most used Markdown bits and I cannot bring myself to use (let alone pay for) a text editor that throws away screen real estate for the sake of a decorative frame. I'm not sure what's so awful about Elements' price either. Both Edito and Elements are $4.99 and Elements is a universal app. Elements lacks HTML export, but it has a Markdown preview and supports opening up Markdown source files from other iOS apps. Elements also has a handy scratchpad for storing bits of text that you can copy to and from while working on your main body of text. Lastly, Elements was the first iOS text editor to support Dropbox syncing. Secondgear Software also makes MarkdownMail if you want to email HTML which was the first Markdown-supporting iOS app in the App Store. It's an additional $3.99, but once again, it's a universal app.
I'll give you that the extra row of keys is nice; iA writer does something similar too. But I already have TextExpander snippets set up for my most used Markdown bits and I cannot bring myself to use (let alone pay for) a text editor that throws away screen real estate for the sake of a decorative frame. I'm not sure what's so awful about Elements' price either. Both Edito and Elements are $4.99 and Elements is a universal app. Elements lacks HTML export, but it has a Markdown preview and supports opening up Markdown source files from other iOS apps. Elements also has a handy scratchpad for storing bits of text that you can copy to and from while working on your main body of text. Lastly, Elements was the first iOS text editor to support Dropbox syncing. Secondgear Software also makes MarkdownMail if you want to email HTML which was the first Markdown-supporting iOS app in the App Store. It's an additional $3.99, but once again, it's a universal app.
I'll give you that the extra row of keys is nice; iA writer does something similar too. But I already have TextExpander snippets set up for my most used Markdown bits and I cannot bring myself to use (let alone pay for) a text editor that throws away screen real estate for the sake of a decorative frame. I'm not sure what's so awful about Elements' price either. Both Edito and Elements are $4.99 and Elements is a universal app. Elements lacks HTML export, but it has a Markdown preview and supports opening up Markdown source files from other iOS apps. Elements also has a handy scratchpad for storing bits of text that you can copy to and from while working on your main body of text. Lastly, Elements was the first iOS text editor to support Dropbox syncing. Secondgear Software also makes MarkdownMail if you want to email HTML which was the first Markdown-supporting iOS app in the App Store. It's an additional $3.99, but once again, it's a universal app.
I'll give you that the extra row of keys is nice; iA writer does something similar too. But I already have TextExpander snippets set up for my most used Markdown bits and I cannot bring myself to use (let alone pay for) a text editor that throws away screen real estate for the sake of a decorative frame. I'm not sure what's so awful about Elements' price either. Both Edito and Elements are $4.99 and Elements is a universal app. Elements lacks HTML export, but it has a Markdown preview and supports opening up Markdown source files from other iOS apps. Elements also has a handy scratchpad for storing bits of text that you can copy to and from while working on your main body of text. Lastly, Elements was the first iOS text editor to support Dropbox syncing. Secondgear Software also makes MarkdownMail if you want to email HTML which was the first Markdown-supporting iOS app in the App Store. It's an additional $3.99, but once again, it's a universal app.
Great post! I learned quite a bit from this post and the podcast. Thanks!
Do you ever need to collaborate with others using the review features in either Word or Pages? If so, how do you manage those types of collaborations while still keeping the source in Markdown?
Great post! I learned quite a bit from this post and the podcast. Thanks!
Do you ever need to collaborate with others using the review features in either Word or Pages? If so, how do you manage those types of collaborations while still keeping the source in Markdown?
Great post! I learned quite a bit from this post and the podcast. Thanks!
Do you ever need to collaborate with others using the review features in either Word or Pages? If so, how do you manage those types of collaborations while still keeping the source in Markdown?
Great post! I learned quite a bit from this post and the podcast. Thanks!
Do you ever need to collaborate with others using the review features in either Word or Pages? If so, how do you manage those types of collaborations while still keeping the source in Markdown?
Great post! I learned quite a bit from this post and the podcast. Thanks!
Do you ever need to collaborate with others using the review features in either Word or Pages? If so, how do you manage those types of collaborations while still keeping the source in Markdown?
Great post!
Can you provide information about Clients & Case, Billing Codes and Legal ?
Sound like this is the core of your workflow.
Great post!
Can you provide information about Clients & Case, Billing Codes and Legal ?
Sound like this is the core of your workflow.
Great post!
Can you provide information about Clients & Case, Billing Codes and Legal ?
Sound like this is the core of your workflow.
Great post!
Can you provide information about Clients & Case, Billing Codes and Legal ?
Sound like this is the core of your workflow.
Great post!
Can you provide information about Clients & Case, Billing Codes and Legal ?
Sound like this is the core of your workflow.
Deeper into geekiness you go David 🙂
Regs for the UK.
Deeper into geekiness you go David 🙂
Regs for the UK.
Deeper into geekiness you go David 🙂
Regs for the UK.
Deeper into geekiness you go David 🙂
Regs for the UK.
Deeper into geekiness you go David 🙂
Regs for the UK.
I use Markdown, but I'm currently trying Snippets (the text expander, not code management software) and find it's not quite up to the task. It's fine for inserting a normal markdown link with placeholders (I use ##TEXT## and ##URL##), but appending the reference is just too advanced for the software at this point. Still, it's handy for doing almost everything else in Markdown.
I use Markdown, but I'm currently trying Snippets (the text expander, not code management software) and find it's not quite up to the task. It's fine for inserting a normal markdown link with placeholders (I use ##TEXT## and ##URL##), but appending the reference is just too advanced for the software at this point. Still, it's handy for doing almost everything else in Markdown.
I use Markdown, but I'm currently trying Snippets (the text expander, not code management software) and find it's not quite up to the task. It's fine for inserting a normal markdown link with placeholders (I use ##TEXT## and ##URL##), but appending the reference is just too advanced for the software at this point. Still, it's handy for doing almost everything else in Markdown.
I use Markdown, but I'm currently trying Snippets (the text expander, not code management software) and find it's not quite up to the task. It's fine for inserting a normal markdown link with placeholders (I use ##TEXT## and ##URL##), but appending the reference is just too advanced for the software at this point. Still, it's handy for doing almost everything else in Markdown.
I use Markdown, but I'm currently trying Snippets (the text expander, not code management software) and find it's not quite up to the task. It's fine for inserting a normal markdown link with placeholders (I use ##TEXT## and ##URL##), but appending the reference is just too advanced for the software at this point. Still, it's handy for doing almost everything else in Markdown.