Standard library / html/template
html/template.HTML
Trusted HTML fragment; bypasses ordinary HTML text escaping. Never cast arbitrary user data. Expected stdout: '<p><b>fixed</b></p>\n'.
Formal Syntax & Structure
go syntaxgo
type HTML stringWorking Example
Example Snippetgo
package main
import ( "fmt" "html/template" "os")
func check(e error) { if e != nil { panic(e) }}
func main() { t := template.Must(template.New("x").Parse("<p>{{.}}</p>")) check(t.Execute(os.Stdout, template.HTML("<b>fixed</b>"))) fmt.Println()}