Skip to content

Try our new Crash Courses!

Buy one of our new Crash Courses, now hosted on Teachable.

Links – Markdown

Demo

Summary

Markdown:

[Link example 1](http://www.example.com/)

[Link example 2][1]

[1]: http://www.example.com/

Click here to see an example of what this code looks like when rendered on GitHub. (Click the Raw button to see the actual Markdown code.)

Details

There are two ways of creating links in Markdown. With the first method, you wrap the text you want to turn into a link with square brackets. Then you place the URL in parentheses right after the text.

[Link example](http://www.example.com/)

With the second method, you wrap the text you want to turn into a link with square brackets. Then you put a number in square brackets right afterwards that serves as an id. Then at the bottom of your Markdown file you write the number in square brackets again, followed by a colon, then a space, and then the URL you want to link to.

[Link example][1]
[Another link example][2]
<!-- Other code can go here -->
[1]: http://www.example.com/
[2]: https://simpledev.io/

The first way of writing links in Markdown keeps the URL next to the link text.

The second way of writing links in Markdown allows you to put all of the URLs for your links at the bottom of your Markdown file, separate from the link text. This can result in a cleaner Markdown file.

Exercises

First, recreate the code snippet from the Demo section in your Markdown file. Then try customizing the text.

References

Markdown Reference on CommonMark

Lesson tags: Free Lesson
Back to: Markdown Reference > Markdown Syntax