What `body!= body` in Jade template means?

express, pug

Solution

I quote, from Jade's documentation/guide:

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

p!= aVarContainingMoreHTML

When using `res.render('index')` the rendered contents of `index.jade` (in your case) will be passed as a local variable to your layout file (`layout.jade`). The local variable is available as body. However, if we simply output the body local variable, it would be escaped (special characters will be encoded). Thus, by using !=, the contents of body will be outputted unescaped.

Check out: http://expressjs.com/guide.html#view-rendering

Problem

This question is related to using Jade templates with Express.js. I know that when I write `layout.jade` that contains: ``` !!! html body != body header h1 My header ``` When I call `res.render('index')` then my actual template is rendered to beginning of the `body`. My question is this: what does `!= body` mean and how Jade/Express use that to determine the placement for my template inside the layout? I know that if I change `!= body` inside another element then the actual view is rendered there instead. Does anyone know where this feature is documented?

Original source