Adding Links in Markdown

Wondering about the syntax for adding links in Markdown? Here are a few example of adding external, internal and anchor links in Markdown.

Markdown supports adding various kinds of links. The syntax for all of them is the same:

[Link text](link_address)

The same syntax can be used for adding external links, internal links (another document in the same project) and links to the document's same section.

I'll show each of them with examples. Let's start with the simplest of them all.

If you want to link a particular text to a web URL, you can use the syntax link this:

[Text to link](https://link-url.com)

Not clear enough? Let me share an example.

I want to write this text:

Join our community forum and seek help from us and the fellow members.

The text 'community forum' is linked to the URL https://itsfoss.community/

The same can be written in Markdown as:

Join our [community forum](https://itsfoss.community/) and seek help from us and the fellow members.

To see this in action, enlarge the screenshot below that shows both the Markdown code and the rendered text.

Markdown editor showing external link example in preview mode
External link example in Markdown
πŸ’‘
You can add a naked but clickable URL in Markdown like <naked_URL>.

Markdown allows you to link the subheadings. This way, you can create a beautifully crafted document where users can quickly jump to a specific section. This is also called an anchor link.

The syntax is pretty much the same, except here, you'll have to use the text of the subheading.

[Text to sub-heading](#text-of-the-subheading)

Things to keep in mind is:

  • You can only link to subheadings, not normal paragraph text
  • This link starts with #
  • There should be no upper cases in the link, even if the subheading has it
  • The white spaces in the subheading text are replaced by -

Let me share an example. I have a subheading with the text "Concluding part". Now I want to link to this section from another part of the file.

or just [jump to the conclusion](#concluding-part)

This screenshot will make things even more clear.

Markdown editor showing example of linking to a section
Linking to a section

Not all markdown editors support it properly but in theory, it should work.

Some Markdown based document management solutions like Obsidian allow you to interlink other markdown files in the same project.

Now, this is tricky because the file path hierarchy may not be the same in all the tools.

For example, I have this directory hierarchy.

Directory structure for Markdown internal link example

To internal link to the file Solution_to_Exercise_2.md under the Exercise_2 folder, I do the following:

Let's move to the [second exercise](/Exercise_2/Solution_to_Exercise_2).

Here's a screenshot of the Obsidian editor:

Example of internal linking in Markdown

Linked it or not?

Markdown is awesome for web writing. It is also good for personal note-taking once you get the hang of it.

I have created this cheat sheet to help you get familiar with it. Feel free to download it.

If you want a detailed explanation of Markdown syntax, we have a guide for that as well.

Basic Markdown Syntax Explained [With Free Cheat Sheet]
Learning markdown could help you a lot with writing for web. Here’s a complete beginner’s guide to Markdown syntax with downloadable cheat sheet.

I hope you find this helpful in adding links in Markdown. If you have any questions or suggestions, please feel free to leave a comment.

Interested in DevOps and Cloud Career? Don't miss this πŸ‘‡

Linux Foundation Bootcamp Offer
About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventure. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie and classic detective mysteries πŸ•΅οΈβ€β™‚οΈ

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.