From e976aa1be713c9c46d67565857d379e3a1449300 Mon Sep 17 00:00:00 2001 From: adnano Date: Mon, 10 May 2021 00:50:19 -0400 Subject: [PATCH] Add safeHTML, safeCSS, etc. functions --- config.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config.go b/config.go index 366b6f3..39c6bab 100644 --- a/config.go +++ b/config.go @@ -70,9 +70,11 @@ func LoadConfig(path string) (*Config, error) { } return b.String(), nil }, - "html": func(s string) template.HTML { - return template.HTML(s) - }, + "safeHTML": func(s string) template.HTML { return template.HTML(s) }, + "safeHTMLAttr": func(s string) template.HTMLAttr { return template.HTMLAttr(s) }, + "safeCSS": func(s string) template.CSS { return template.CSS(s) }, + "safeJS": func(s string) template.JS { return template.JS(s) }, + "safeURL": func(s string) template.URL { return template.URL(s) }, }) return c, nil