如何在CoffeeKup模板中使用文字HTML?

nic*_*ten 3 javascript templates node.js coffeescript coffeekup

我正在成为CoffeeKup的忠实粉丝,但我想知道如何在这样的模板中使用文字HTML?例如,当我只想复制粘贴一些现有的非CoffeeKup标记时.

小智 5

您可以使用以下text函数添加任意文本:

text '<p>foo</p>'
Run Code Online (Sandbox Code Playgroud)

对于多行字符串,CoffeeScript的heredocs很高兴:

text '''
  <table>
    <tr>
      <td>Foo</td>
    </tr>
  </table>
'''
Run Code Online (Sandbox Code Playgroud)

只需确保您已autoescape设置为false(默认值).