Comments

Haml, Slim, and EGO templates all support comments, but the markers differ by language. Comments can either be left in the rendered HTML or removed from the rendered HTML.

HTML Comments

In Haml and Slim, rendered HTML comments are created by using the forward slash / character.

%p Now you see me 
/ and now you don't

renders as:

<p>Now you see me</p>
<!-- and now you don't -->

Haml Comments

Haml comments that are removed from the rendered HTML are created by using a dash and a pound -# character combination.

%p Now you see me
-# and now you don't

renders as:

<p>Now you see me</p>

These types of comments are stripped out and will not become part of the generated Go code.

Slim Comments

Slim uses / for comments and /! for HTML comments that should be preserved.

p Now you see me
/ and now you don't
/! this comment is preserved

EGO Comments

EGO comments use <%# ... %> and are removed from the rendered HTML.

<p>Now you see me</p>
<%# and now you don't %>

Nesting

Both kinds of comments can be used to comment out multiple lines of content.

%p Now you see me
/ 
  and now you don't
%p Now you see me
-# 
  %p and now you don't

renders as:

<p>Now you see me</p>
<!-- 
  and now you don't
-->
<p>Now you see me</p>

Conditional Comments

Conditional comments are a feature of Internet Explorer in versions prior to IE 10. They are used to include or exclude content from the page based on the version of Internet Explorer that is being used. They are not part of the HTML5 specification and are not supported by GoHT.