Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jade's buffer technique (exclamation mark)

Tags:

buffer

pug

In github's jade documentation, it talks about the buffered technique:

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

p!= aVarContainingMoreHTML

I don't quite understand the use of exclamation mark here, I mean, why not just use:

p= aVarContainingMoreHTML

In fact, I don't quite understand the usage of the buffer technique, there isn't much related to it in the doc

like image 503
webberpuma Avatar asked Aug 30 '26 01:08

webberpuma


1 Answers

Without the !, p= aVarContainingMoreHTML would render brackets as > and &lt whereas p!= aVarContainingMoreHTML would render the var as HTML. You should only use ! when you really need to.

like image 126
Jonathan Ong Avatar answered Sep 03 '26 21:09

Jonathan Ong



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!