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?
agent-j
Code buffered by = is escaped by default for security, however to output unescaped return values you may use !=
p!= aVarContainingHTML
The syntax you need is :
!{yourJsVariable}
if you use #{yourJsVariable}
it shows < >, but with !{}
it doesn't.
来源:https://stackoverflow.com/questions/11191421/rendering-html-in-variable-using-jade