Reputation: 3154
Having a little problem with inserting pure html into Jade. I store html-formatted text in db. And router takes these data and sends to the jade template. For the moment the output html i recieve is:
<p>some text</p>
<p>some text</p>
In jade template i get data in this way:
| #{content}
div #{content2}
And the router send it this way:
admin.query("SELECT * FROM `Article` WHERE `ArticleId` = " + req.params.id + ";", function (err, data) {
res.render('static.jade', {
'title' : data[0].ArticleTitle,
'page_title' : data[0].ArticleTitle,
'content' : data[0].ArticleContent,
'content2' : data[0].ArticleContent
});
});
I hope there is the way to fix it. That's gonna be big problem storing jade-formatted text in db. Regards for any help.
Upvotes: 1
Views: 547
Reputation: 3466
Use !{ variable }
to include unescaped content.
So:
| !{content}
div !{content2}
See more here.
Upvotes: 2