From fd76b9995e7ef8fdbf6d5d0e48a442d5b8532a93 Mon Sep 17 00:00:00 2001 From: AiAe Date: Sat, 26 Oct 2024 23:06:01 +0300 Subject: [PATCH] Allow br tag --- stringutil/sanitize.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stringutil/sanitize.go b/stringutil/sanitize.go index 4ae52b7..c585963 100644 --- a/stringutil/sanitize.go +++ b/stringutil/sanitize.go @@ -5,7 +5,7 @@ import "github.com/microcosm-cc/bluemonday" func SanitizeHTML(html string) string { p := bluemonday.NewPolicy() - p.AllowElements("p", "b", "strong", "i", "em", "u", "ul", "ol", "li", "s", "a", "img", "table", "tr", "td", "center") + p.AllowElements("p", "b", "strong", "i", "em", "u", "ul", "ol", "li", "s", "a", "img", "table", "tr", "td", "center", "br") p.AllowAttrs("style").OnElements("p") p.AllowAttrs("href").OnElements("a") p.AllowAttrs("src", "alt", "width", "height", "style").OnElements("img")