How to Tell Hugo Not to Parse HTML

Hongtao Hao / 2020-11-02


I found the solution here by Hissatsu . You can use encode to convert XML to US-ASCII.

For example:

<p>I do not want to show this content.</p>

However, if you encode multiple lines, you’ll find that the output will be only one line. You can solve this problem by adding </br> at the end of each line except the last line.

For example, if I want the output to be this:

{{< block class="note" >}}
This is a note.
{{< end >}}

I’ll use this:

{{&lt;  block class=&quot;note&quot;  &gt;}} </br>
This is a note. </br>
{{&lt; end &gt;}}

Last modified on 2021-10-05