question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Opening link in a new tab

See original GitHub issue

Is it possible to add target="blank" to Markdown links?

For example I wish to have the following URL open in a new browser tab when I left click: [link to website](http://www.website.com)

Cheers

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

77reactions
joelbowencommented, Mar 15, 2021

For anyone else that ends up here via google search (like I did) and didn’t notice this in the docs, you can now use the prop linkTarget to achieve this like so:

<ReactMarkdown linkTarget="_blank" children={...} />

See the docs for more info.

75reactions
rexxarscommented, Feb 22, 2018

You can use a custom renderer:

function LinkRenderer(props) {
  return <a href={props.href} target="_blank">{props.children}</a>
}

<ReactMarkdown
  source="Click [here](https://espen.codes/) to visit external site"
  renderers={{link: LinkRenderer}}
/>
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Use HTML to Open a Link in a New Tab - freeCodeCamp
To create a link on a web page, you need to wrap an element (text, a picture, and so on) in an anchor...
Read more >
How to Open a New Tab When Clicking a Link in Google ...
To quickly open a link in a new tab on Google Chrome, hold down the control button while clicking on it with your...
Read more >
Open link in new tab or window - html - Stack Overflow
If you set it to _tab or _new then it opens a window with that name. If a user clicks that link, goes...
Read more >
3 Ways to Open a Link in a New Tab - How-To Geek
Ctrl + Click. The first method requires a keyboard and a mouse or trackpad. Simply press and hold the Ctrl key (Cmd on...
Read more >
How to Force Your Browser to Open a Link in a New Tab
Use Keyboard with Mouse/Trackpad ... You can load any link in a new browser tab by clicking or tapping on it while holding...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found