在段落内添加链接时遇到问题。
jade 模板语法:
p Here is link to #[a(href='https://google.com/') google link]
结果是:这里是 google link 的链接
我想要的是:这里是https://google.com/的链接
我尝试了这种语法,但它不起作用:
p Here is link to #[a(href='https://google.com/') https://google.com/]
如果链接显示有 http://
或 https://
,则会发生错误。
感谢您的帮助!
最佳答案
看来您可以使用 Markdown 过滤器在段落内写入链接:
p
| Here is link to
a(href='https://google.com/') https://google.com/
编辑 1
也可以使用本地人来完成..
{
URL: 'https://google.com/'
}
..和插值:
p Here is link to #[a(href='#{URL}') #{URL}]
编辑2
如果单引号不妨碍,就这样做:
p Here is link to #[a(href='https://google.com/') 'https://google.com/']
编辑3
它与EDIT 1完全相同,但没有本地变量:
p Here is link to #[a(href='https://google.com/') #{'https://google.com/'}]
关于javascript - Jade 模板 - 使用 URL 作为链接标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38376572/