diff --git a/util/util.go b/util/util.go index 6f4629e..0c09d5e 100644 --- a/util/util.go +++ b/util/util.go @@ -53,13 +53,17 @@ type URL struct { } func CleanHTML(content string) (string, []URL) { - stripped := bluemonday.NewPolicy().AllowElements("p", "br").AllowAttrs("href", "class").OnElements("a").Sanitize(content) + stripped := bluemonday.NewPolicy().AllowElements("p", "br", "li", "ul").AllowAttrs("href", "class").OnElements("a").Sanitize(content) urls := getURLs(stripped) - stripped = bluemonday.NewPolicy().AllowElements("p", "br").Sanitize(content) + stripped = bluemonday.NewPolicy().AllowElements("p", "br", "li", "ul").Sanitize(content) stripped = strings.ReplaceAll(stripped, "
", "\n") stripped = strings.ReplaceAll(stripped, "
", "\n") stripped = strings.ReplaceAll(stripped, "

", "") stripped = strings.ReplaceAll(stripped, "

", "\n\n") + stripped = strings.ReplaceAll(stripped, "
  • ", "* ") + stripped = strings.ReplaceAll(stripped, "
  • ", "\n") + stripped = strings.ReplaceAll(stripped, "", "\n") stripped = strings.TrimSpace(stripped) stripped = html.UnescapeString(stripped) return stripped, urls