Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jade template engine, rendering HTML as text

Tags:

node.js

pug

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!

like image 245
Masiar Avatar asked Feb 06 '12 17:02

Masiar


1 Answers

each item in items
  li
   | #{item.name} #{item.inStock}
   a(href="/item/"+item.uniqueId) buy now!
like image 177
Mâtt Frëëman Avatar answered Oct 09 '22 13:10

Mâtt Frëëman