Comments
The {! … } tag introduces a comment. Comment tags are consumed by the parser and emit nothing to the output.
Basic syntax
{! a short note about the next block }Data:
var person = new
{
Name = new { First = "John", Last = "Doe" }
};Template:
<p>Hello {Name.First},</p>{! we want to keep this greeting informal }
<p>How can we be of assistance?</p>Result:
<p>Hello John,</p>
<p>How can we be of assistance?</p>Multiline comments
Comment tags can span multiple lines:
{!
Renders the customer's billing block.
Falls back to a shipping address when billing is null.
}Bracket handling inside comments
A comment may contain bracket characters. The parser tracks open/close pairs so that matched brackets within the comment body do not end the tag prematurely:
| Inside the comment | Parses as |
|---|---|
{ … } (matched pair) | Part of the comment body |
{{ … }} (matched escaped pair) | Part of the comment body |
Unmatched } | Ends the comment |
If a comment must contain a close brace that has no matching open brace, escape it with a backslash:
{! test comment with escaped close bracket \} }The escaped } is emitted as part of the (discarded) comment body and does not terminate the tag.
Parser behavior
Comments are scanned by the parser and participate in MergeException line/column accounting. A misclosed comment surfaces as a parse-time error at the comment’s position.
Common uses: documenting the data shape a section assumes, explaining a ..\ walk or {#with} shift, or marking incomplete sections ({! TODO: localize }).
Whitespace
{!} accepts - trim markers ({-! … -}) and is affected by engine-level TrimWhitespace. A comment followed by a newline often produces a stray blank line in default mode — apply trim markers (or enable global trim) to suppress it.
See Whitespace Control.
Next steps
- Whitespace Control — keep comments from leaving blank lines behind
- Debugging —
{@}is the diagnostic counterpart to{!}: emit content to trace listeners without affecting output