Hello there
I’m converting the \n to <br>
tag,
strings.Replace(data.Message, "\n", "<br>", -1)
when I want to show it in the HTML template the
tag is skipped and doesn’t work and just is shown in the template just like a text.

in the HTML template I’m rendering like:
<p style="text-align: justify;">{{.Message}}</p>
NobbZ
(Norbert Melzer)
2
Are you using html/template
or text/template
?
The former will “autoescape” HTML characters to avoid injections.
You can use template.HTML()
to mark a string as “safe”.
1 Like
system
(system)
Closed
3
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.