In this short post, find out how to open a markdown link in a new tab.

When using markdown to create your blog or any web page using a markdown parser we might want to open the link in our webpage in a new tab.

In markdown, we can create a link using the markdown syntax like this

[Link to google](

This will create <a> tag link in our parsed HTML output link this

<a href="" >Link to google</a>

When we click this link, it will open google in the same tab.

So how can we open the link in a new tab in markdown ?

To open a link in a new tab in our browser is very simple, we just have to use the target attribute in our <a> tag.

Even though there is no native way to add any attributes in our markdown syntax, markdown allows us to use plain HTML tags whenever needed.

So, we can use write the <a> in our markdown document and set target='_blank' attribute.

<a href="" target="_blank">Link to google</a>

This code will create the link in our webpage which when clicked will open the link in a new tab in our browser.

💾 Recommended Articles