Markdown is a great way to write formatted text in any plain text editor. You might already know how to make text bold or italicized, or add a table, but there’s a less-common feature I’ve come to appreciate: reference links.
You’ve probably seen lists of references on Wikipedia articles, reference manuals, and other places. Markdown also gives you the option to create a reference list, and it’s a great way to clean up Markdown files that are using a lot of links.
References vs. Inline Links
The most common links in Markdown are inline links, which require you to type the web address directly after the word or phrase that needs to be linked. For example, this creates a link toHow-To Geekon the word “website”:
These work well for occasional links, but they become messy and difficult to read in documents with many links, or documents using the same link multiple times. For example, a cover letter or resume could look like this:
That’s difficult to read, especially if you’re using a text editor without syntax highlighting for Markdown. This is where a reference list can be useful, as it moves the links out of the way of the written text.
Here’s the same example, but using reference links instead of inline links:
The other main advantage to a reference list is that each reference can be used multiple times. For example, using the Red Hat link in another section of that document would just require typing[4]again, instead of the entire web address.
With references, you may make your link-heavy Markdown documents much more readable, and Markdown parsers will still render them exactly the same as inline links. The list can be anywhere in your document.
More Features
Markdown has some additional options for references that can be helpful in some situations. First, you can use words in the place of numbers to identify references. Here’s an example:
This is a great option for links that you’re using frequently, since it’s usually easier to remember a word or key phrase while working on a document than a number. Of course, if you make the ID too long in a document with many links, you’re back to the original problem of your document being difficult to read. I recommend keeping it to one or two words, or just sticking to numbers. Also, link names are not case-sensitive.
Markdown also supports implicit link shortcuts, so if you’re already typing the ID as the link text, you may have empty brackets for the link definition instead of repeating yourself. Here’s that example again, but with the shortcut:
Finally, you can add a title to each reference. This can be helpful if the URL or ID doesn’t explain anything about the web page, like a product page without the product name in the web address. Most Markdown HTML converters will also add it as the title attribute of the link tag.
You can use titles in references like this example:
Now you know how to use references in Markdown. I have started using this feature more often in outlines and other documents that use repeat links, and it’s a lot better than copy and pasting the same links over and over again. Give it a try the next time your inline links are getting out of control.