Output control - misonou/waterpipe GitHub Wiki
By default, reserved characters from evaluated outputs are encoded, while the static content in the template are parsed as valid HTML with whitespaces being collapsed. For example,
<p class="example">{{html}}</p>will produce:
<p class="example"><b>This is HTML.</b></p>Broken and unmatched tags are properly fixed:
<div a=\"\" b\" c=><b></div></b>will produce:
<div a="" b c><b></b></div>Evaluation can be output as-is by prefixing the expression by and & character. For example,
<p class="example">{{&html}}</p>will produce:
<p class="example"><b>This is HTML.</b></p>When template content has to be treated as-is without being parsed and HTML, set html options to false.
waterpipe(template, data, { html: false });For example,
--------------------
< This is not HTML >
--------------------
{{html}}
--------------------will produce:
--------------------
< This is not HTML >
--------------------
<b>This is HTML.</b>
--------------------In verbatim mode, whitespaces and indentations are preserved except for the lines containing only flow-control tags. For example,
Items:
{{foreach items}}
- {{.}}
{{/foreach}}will produce:
Items:
- 1
- 2
- 3Noted that line 2 and 4 in the template are stripped.