node.js 使用 Jade 在变量中呈现 HTML
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11191421/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Rendering HTML in variable using Jade
提问by tofutim
I have some text stored in a variable which contains some HTML. For example, the <b>cat</b> in the hat. However, when I render it in Jade, it shows up with the tags instead of rendering the formatting. How can I fix this?
我有一些文本存储在一个包含一些 HTML 的变量中。例如,帽子上的 <b>cat</b>。但是,当我在 Jade 中呈现它时,它会显示标签而不是呈现格式。我怎样才能解决这个问题?
回答by agent-j
回答by akazemis
The syntax you need is :
您需要的语法是:
!{yourJsVariable}
if you use #{yourJsVariable}it shows < >, but with !{}it doesn't.
如果您使用#{yourJsVariable}它显示 < >,但使用!{}它不会。

