Is there a way to let a Link, written in githubs markdown, open in a new tab?
All posts I have found related to this suggests to use HTML and target="_blank"
, which is fine with me, but that doesn't work.
For example this link:
<a href="http://stackoverflow.com" target="_blank">Go</a>
Does not open in a new tab. I'm no interested in replies for all kind of different markdown syntaxes, but only in a solution that will work when I write my markdown on github.
Albert Kim just discovered one way to make links open in new browser tabs for R Markdown users: you can add an attribute target="_blank" after a link, e.g., [example website](https://example.com){target="_blank"} .
How do I make a link open in a new tab in markdown? You just add the target="_blank" attribute to your anchor tag so the links open up in a different browser tab.
Links. You can create an inline link by wrapping link text in brackets [ ] , and then wrapping the URL in parentheses ( ) . You can also use the keyboard shortcut Command + K to create a link.
Well it seems that the simple answer is "It's not possible". Github does not include the target attribute even if you use plain HTML, so it's not a in the final HTML Anchor tag. Annoying, but OK, users can just do a CTRL+click (on Windows and Linux) or CMD+click (on MacOS) on the link, the get the same behavior.
There is a solution specific to websites using GitHub pages: adding line
markdown: kramdown
to file _config.yml
, you can use [go](http://stackoverflow.com){:target="_blank" rel="noopener"}
because then GitHub pages engine uses another markdown called kramdown for generating html. However, it does not work on previews and in markdown rendered by GitHub directly in the project repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With