我可以创建带有 'target="_blank"' 的链接吗在降价? [英] Can I create links with 'target="_blank"' in Markdown?
问题描述
有没有办法在 Markdown 中创建在新窗口中打开的链接?如果没有,您建议使用什么语法来执行此操作?我会将它添加到我使用的 Markdown 编译器中.我认为这应该是一种选择.
Is there a way to create a link in Markdown that opens in a new window? If not, what syntax do you recommend to do this? I'll add it to the markdown compiler I use. I think it should be an option.
推荐答案
就 Markdown 语法而言,如果您想获得详细信息,您只需要使用 HTML.
As far as the Markdown syntax is concerned, if you want to get that detailed, you'll just have to use HTML.
<a href="http://example.com/" target="_blank">Hello, world!</a>
我见过的大多数 Markdown 引擎都允许使用普通的旧 HTML,只是在这种情况下,通用文本标记系统不会削减它.(例如 StackOverflow 引擎.)然后他们通过 HTML 白名单过滤器运行整个输出,无论如何,因为即使是仅 Markdown 的文档也很容易包含 XSS 攻击.因此,如果您或您的用户想要创建 _blank
链接,那么他们可能仍然可以.
Most Markdown engines I've seen allow plain old HTML, just for situations like this where a generic text markup system just won't cut it. (The StackOverflow engine, for example.) They then run the entire output through an HTML whitelist filter, regardless, since even a Markdown-only document can easily contain XSS attacks. As such, if you or your users want to create _blank
links, then they probably still can.
如果这是您将经常使用的功能,那么创建您自己的语法可能是有意义的,但它通常不是一个重要的功能.如果我想在新窗口中启动该链接,我会自己按住 Ctrl 键并单击它,谢谢.
If that's a feature you're going to be using often, it might make sense to create your own syntax, but it's generally not a vital feature. If I want to launch that link in a new window, I'll ctrl-click it myself, thanks.
这篇关于我可以创建带有 'target="_blank"' 的链接吗在降价?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!