首页 文章

Markdown打开一个新窗口链接

提问于
浏览
118

我正在尝试编辑一个使用modx cms的网站,它正在使用Markdown . 现在我想在另一个窗口中打开一个新链接 .

可能吗?谢谢

The Link [Registration](http://www.registration.com)

3 回答

  • 3

    降价中没有此功能,但您可以始终在降价时使用HTML:

    <a href="http://example.com/" target="_blank">example</a>
    
  • 150

    正如this answer所建议的那样:

    [link](url){:target="_blank"}
    

    适用于jekyll或更具体的kramdown,这是markdown的超集,as part of Jekyll's (default) configuration . 但不是为了简单的降价 . ^ _ ^

  • 49

    如果有人想 do this systematically for all external links, CSS is no option . 但是,一旦从Markdown创建(X)HTML,就可以运行以下sed命令:

    sed -i 's|href="http|target="_blank" href="http|g' index.html
    

    当使用带有构建指令的 Makefile 时,可以在单个工作流程中进一步自动化 .

    PS: 这个答案是在Pandoc尚未提供extension link_attributes的时候写的 .

相关问题