【问题标题】:How do I format mixed text in Jade?如何在 Jade 中格式化混合文本?
【发布时间】:2015-02-25 00:08:28
【问题描述】:

我使用 Jade 已经有一段时间了,在同一段落中使用混合文本和标签似乎有问题。例如:

p 
  | For more information, click
  a(href="/here") here
  | to read our documentation.

渲染时,这会在“单击”和“此处”之间留下任何空白,因此看起来像“有关更多信息,请单击此处阅读我们的文档”。

为了强制空格,我在“点击”后使用 ,例如:

p 
  | For more information, click 
  a(href="/here") here
  | to read our documentation.

...但感觉不对。有没有更自然的,翡翠般的方式来做到这一点?还是我应该坚持使用我的 HTML 非阻塞空间?

【问题讨论】:

    标签: pug


    【解决方案1】:

    使用这个

    p For more information, click #[a(href="/here") here ] to read our documentation.
    

    #[] 是 Jade 中字符串或标签中的代码。

    【讨论】:

    • 呈现为:<p>For more information, click a(href="/here") here to read our documentation.</p> 我希望a 成为链接。
    • documentiongithub。看看白色的空格!!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多