Lazy Reference Links Make Markdown Even Easier

By

lazy
Don't worry -- you don't need to touch this.

This one’s pretty nerdy, but if you use Markdown to write anything with links in it (web articles, e-mails and so on) then you’re going to love it. It lets you use “lazy” reference links in Markdown to keep your text nice and tidy, but it does it without the references. Reference links without references? What? Wait…

A reference link usually looks something like this:

This is a [link][cats] to a picture of a cat.

The rest of your article...

[cats] :https://www.lolcats.com

The idea is that you can Keep all the messy links at the end of your document with just a reference in the actual body. When you convert from Markdown to HTML, everything is moved into place. But Brett Terpstra’s Lazy Reference Links script makes it even easier. Instead of pausing to think up a good name for the reference link, you just use an asterisk:

This is a [link][*] to a picture of a cat.

The rest of your article...

[*] :https://www.lolcats.com

The links need to be kept underneath the paragraph they refer to, but that’s it. If you have more than one link, then the script will use them in order, which shouldn’t get too messy in a paragraph.

The Ruby script can be turned into an iOS System Service and then conjured with a keyboard shortcut, or you can set it to run automatically in your Markdown text editor before the main Markdown conversion.

This strikes me as a perfect feature for people writing short text in Markdown. If you’re working on a big feature, regular reference links are worth the extra effort as they are more robust during the editing process, but if all you;re doing is banging out a few paragraphs then Lazy Links are the way to go.

Source: Brett Terpstra

Newsletters

Daily round-ups or a weekly refresher, straight from Cult of Mac to your inbox.

  • The Weekender

    The week's best Apple news, reviews and how-tos from Cult of Mac, every Saturday morning. Our readers say: "Thank you guys for always posting cool stuff" -- Vaughn Nevins. "Very informative" -- Kenly Xavier.