markdown , gatsby ,

Markdown - Link within document

by Abhith Rajan FollowNovember 06, 2017 · 2 min read · Last Updated:
Share this

I use markdown as the writing language for my blog posts on this website. It is clean and minimal so I prefer it over HTML.

Today I updated some content in one of my blog posts, Xamarin development - problems and solutions and in which, there is a summary of issues listed on the top and the solutions for each of them explained below one by one and there wasn't any link between the list items and the explanations.

So for better usability, I had to link them, I know how to do it in HTML and now I learned how to do it on Markdown.

To create the link,

[Link text](#some-id)

And add anchor point the target area by,

# <a name="some-id"></a> DETAIL SECTION

Notice the usage of "some-id" in both. You can replace "some-id" with any proper text.

As you can see, we are adding an anchor tag (HTML element) to the Markdown to make it work. Having HTML in markdown file is not that nice and some linters will complain about the same, this as a dirty hack.

Update 1 - 2nd May 2019

If you are using some kind of markdown transformer, there might be an option to make the header links automatically. Like gatsby-remark-autolink-headers in case of Gatsby.

This page is open source. Noticed a typo? Or something unclear?
Improve this page on GitHub

Abhith Rajan

Written by Abhith Rajan FollowBuy me a coffee
Abhith Rajan is an aspiring software engineer with more than 6 years of experience and proven successful track record of delivering technology-based products and services.