Standard library / html/template

html/template.CSS

Trusted CSS content; bypasses relevant filtering. Never convert untrusted text. Expected stdout: '<style>p{color:red}</style>\n'.

Formal Syntax & Structure

go syntaxgo
type CSS string

Working 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("<style>p{color:{{.}}}</style>"))  check(t.Execute(os.Stdout, template.CSS("red")))  fmt.Println()}
Go Reference