|
|
@@ -58,15 +58,16 @@ func ReplaceSanitizer() { |
|
|
|
|
|
|
|
// Allow icons |
|
|
|
sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`^icon(\s+[\p{L}\p{N}_-]+)+$`)).OnElements("i") |
|
|
|
sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`^((icon(\s+[\p{L}\p{N}_-]+)+)|(ui checkbox)|(ui checked checkbox))$`)).OnElements("span") |
|
|
|
|
|
|
|
// Allow unlabelled labels |
|
|
|
sanitizer.policy.AllowNoAttrs().OnElements("label") |
|
|
|
|
|
|
|
// Allow classes for emojis |
|
|
|
sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`emoji`)).OnElements("span") |
|
|
|
sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`emoji`)).OnElements("img") |
|
|
|
|
|
|
|
// Allow icons, checkboxes and emojis on span |
|
|
|
sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`^((icon(\s+[\p{L}\p{N}_-]+)+)|(ui checkbox)|(ui checked checkbox)|(emoji))$`)).OnElements("span") |
|
|
|
|
|
|
|
// Allow generally safe attributes |
|
|
|
generalSafeAttrs := []string{"abbr", "accept", "accept-charset", |
|
|
|
"accesskey", "action", "align", "alt", |
|
|
|