open link in new tab with github markdown using target=“_blank”

北慕城南 提交于 2019-12-09 04:30:56

问题


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.


回答1:


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 the link, the get the same behaviour.




回答2:


The answer should be what @Idavid posted in a comment.

[go](http://stackoverflow.com){:target="_blank"}.

You should also add rel="noopener"

[go](http://stackoverflow.com){:target="_blank" rel="noopener"}


来源:https://stackoverflow.com/questions/41915571/open-link-in-new-tab-with-github-markdown-using-target-blank

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!