Masiar
Masiar

Reputation: 21352

Jade template engine, rendering HTML as text

I have this piece of code in one of my .jade files:

each item in items
  li= item.name + " " + item.inStock + " <a href='/item/"+item.uniqueId+"'>buy now!</a>"

What this renders is:

Of Mice and Men 1000 <a href='/item/1'>buy now!</a>
[...]

As you can see the <a href='/item/1'>buy now!</a> is not rendered as HTML but as plain text. Is there a way to render it as HTML, so that it creates a link?

Thanks!

Upvotes: 5

Views: 4540

Answers (2)

user935712063
user935712063

Reputation: 1401

each item in items
  li
   | #{item.name} #{item.inStock}
   a(href="/item/"+item.uniqueId) buy now!

Upvotes: 5

mna
mna

Reputation: 24003

try the unescaped operator:

li!= ...

it should do the trick.

Upvotes: 4

Related Questions