【问题标题】:Parse URL and create Links On Plain-Text Jade解析 URL 并在纯文本 Jade 上创建链接
【发布时间】:2016-08-09 11:49:22
【问题描述】:

我得到纯文本,其中可能有一个 URL。

例如 : 在一天内学习 abc www.englishspeaking.com

这里我有一个 URL。我想转换它有一个链接。我正在使用 Jade 模板引擎。有没有办法在 Jade 模板引擎中做到这一点。

【问题讨论】:

    标签: javascript node.js pug template-engine


    【解决方案1】:

    您可以为此使用已构建的 npm。像这样,我找到了anchrome,它也对我有用

    【讨论】:

      【解决方案2】:

      像这样使用markdown 过滤器

      :markdown
        this is the start of the para.
        [a link](http://example.com)
        and this is the rest of the paragraph.
      

      【讨论】:

      • 感谢您的回复。使用我的例子,我可以这样做:markdown [a link](在一天内学习 abc www.englishspeaking.com)?
      • @MAS1112 试试这样:在一天内学习 abc a(href='www.englishspeaking.com') 在这里
      • 它会起作用的。我必须先从文本中解析 url。好的,它明白了 :) .. 让我也等其他人来贡献。
      猜你喜欢
      • 2014-03-17
      • 2011-04-08
      • 2023-04-05
      • 2011-03-09
      • 1970-01-01
      • 2013-07-28
      • 1970-01-01
      • 2011-04-29
      • 2018-10-27
      相关资源
      最近更新 更多