golang - html/templates - Replacing newlines with <br>

skyhew

New Member
I'm loading a text file that has newlines in it, and pass it to \[code\]html/templates\[/code\].When substituting all the \[code\]\n\[/code\] with \[code\]<br>\[/code\] in the loaded string, they are escaped by the template to html \[code\]<br>\[/code\] and displayed in the browser instead of causing a line return.How can I change this apart from switching to \[code\]text/templates\[/code\] (that doesn't have XSS protection)?Thanks
 
Back
Top