Package html/template has the same base functionality as text/template.

The difference is that html/template understands structure of HTML and JavaScript code inside HTML.

Inserted text is escaped based on its surrounding context which eliminates cross-site scripting bugs.

https://codeeval.dev/gist/c65a2e831c705af6f25d8bec639b9b0e

Inserting unescaped HTML

Sometimes you need to subvert escaping of text:

https://codeeval.dev/gist/2e34a0a2794f867e4722191688111084

template.HTML and template.JS are type alises for string so you can assign string values to them.

Templating engine recognizes those types and disables escaping for them.