0

Basically I am coding a blog engine in Nodejs with express4 and jade, and I wish to be able to pass the posts as strings of html to jade, to then loop through them.

I have populated an array with valid strings of html like console.log(items[0]); // prints: <h1>test</h1> however I cannot get my head around how I would print out the html within a DOM.

So far I have tried to make the array global and do something like

each item in items
  item

or simply #{items} however these methods print out html with < > notation in, and duplicates the data like

&lt;<h1>test</h1>&gt;<!--<h1-->test&gt;

I have also tried to pass the html through as a parameter in routes like res.render('index', {items: items});, however this has exactly the same effect

My guess is that perhaps I am trying to render html outside of the html domain, so it can do it but it obfuscates the data. Any suggestions would be appreciated!!

William Paul
  • 337
  • 1
  • 4
  • 13

1 Answers1

-2

I found this: Rendering HTML in variable using Jade

For yours I believe it would be p!= item

Community
  • 1
  • 1
fqhv
  • 1,191
  • 1
  • 13
  • 25