Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rendering HTML in variable using Jade

Tags:

node.js

pug

I have some text stored in a variable which contains some HTML. For example, the <b>cat</b> in the hat. However, when I render it in Jade, it shows up with the tags instead of rendering the formatting. How can I fix this?

like image 762
tofutim Avatar asked Jun 25 '12 14:06

tofutim


People also ask

What is Jade in HTML?

Jade is a template engine for node. js and the default rendering engine for the Express web framework. It is a new, simplified language that compiles into HTML and is extremely useful for web developers. Jade is designed primarily for server-side templating in node.


1 Answers

Code buffered by = is escaped by default for security, however to output unescaped return values you may use !=

p!= aVarContainingHTML 

Pug Doc

like image 178
agent-j Avatar answered Sep 23 '22 12:09

agent-j