javascript - MongoDB emits HTML as plain text -
why isn't html being rendered whenever output result query.
this how save document:
data = { title: "article title", body: "<b>this</b> content!!" }; var article = new article(data); article.save();
and how display it:
h2.articletitle(style="font-style: italic;") #{article.title} p.articlebody(style="margin-top: 20px;") #{article.body}
the out of article body should be: this content!!
but instead outputs everything, including html tag: <b>this</b> content!!
i reading similar question asked told me add dash (-) before article.body. tried:
h2.articletitle(style="font-style: italic;") #{article.title} p.articlebody(style="margin-top: 20px;") - article.body
but didn't output when tried way. appreciated. thanks.
ok problem how outputting jade, template engine i'm using. managed fix replacing # ! symbol.
h2.articletitle(style="font-style: italic;") #{article.title} p.articlebody(style="margin-top: 20px;") !{article.body}
original answer: rendering html in variable using jade
Comments
Post a Comment