Reputation: 15626
My jade template is
div.article
#{content}
the content is <p>Sample Test</p>
so the render result should be
<div class="article">
<p>Sample Text</p>
</div>
but the render result is
<div class="artichle">
<<p>Sample Text</p>></<p>Sample Text</p>>
</div>
Why this happened? How can I render the content with html tag correctly?
Upvotes: 0
Views: 2233
Reputation: 598
Use the unescaped variant of tag texts :
- var html = "<script></script>"
| !{html}
See https://github.com/visionmedia/jade#tag-text for the full explanation
In your example you would write :
div.article
!{content}
Notice that you should be careful with injecting html unescaped code. It may contain cross-site hacks depending on your use case (injecting a redirect in a comment)
Upvotes: 7