Part 7 of our using Markdown in Moodle series, understanding links.
Previous posts in this series
- Introduction to Markdown – https://wp.me/p8KJp1-No
- Editor preferences – https://wp.me/p8KJp1-Nx
- Text formatting with Markdown – https://wp.me/p8KJp1-NJ
- Creating headings with Markdown – https://wp.me/p8KJp1-NQ
- Markdown to create lists – https://wp.me/p8KJp1-O4
- Quoted paragraphs – https://wp.me/p8KJp1-O8
There are a few ways to create links to web resources, or hyperlinks.
The quick and easy way, if you are happy with your linked text being the same as the URL, is to place the URL within angled brackets like so:
The second method is to include the link inline, placing the text you wish readers to click on in square brackets, and the URL of the page they will be taken to immediately afterwards in parentheses with no space or gap between the two sets of brackets (you can also add an optional title for the link in quotes after the URL).
An [example link](http://example.com/ "Optional Title") in a sentence.
The optional title, if included, is displayed in a ‘tooltip’ that appears when the user hovers their mouse over the link text.
This is quite similar to HTML if you are alert familiar with HTML for URL’s.
Footnote style links
For longer links you can avoid disrupting the flow of the main text by using a footnote style, attaching a short identifying name to the link in a second set of square brackets (either using a short explanatory word, phrase or simply a number).
An [example link][ex] in a sentence.
Then, anywhere else in the document, but preferably either directly after the paragraph with the link, or collected with other link URLs at the bottom of the document, you can define the URL associated with the id:
[ex]: http://example.com/ "Optional Title"
The output of this second example would be indistinguishable from the first. It is simply a matter of keeping the working document neatly organised to aid further editing (particularly if you are working with others).
Why not try adding a few links to a Label or Page?
More Markdown next time!