I am generating a bit of Jade based HTML with var generateCodeBlock = jade.compile('div !{text}', {pretty: true});
I want to create something like this
<div>
var json = {
labelA: 'a',
labelB: 2
};
</div>
but when I input {text: 'var json = {\n labelA: 'a',\n labelB: 2\n };'} it ends up creating <div class="setup"> var json = { labelA: 'a', labelB: 2 };</div>. I have also tried using #{text} in jade.compile, but there was no difference.
Why does jade flatten my variable input?
UPDATE: I have now tried creating a separate file for the template with
block codeBlock
div.codeBlock
for part in code
div(class="#{part.className}") !{part.text}
and jade.compileFile and it is still producing var json = { labelA: 'a', labelB: 2 };