summaryrefslogtreecommitdiffstats
path: root/modules/markup/sanitizer.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/markup/sanitizer.go')
-rw-r--r--modules/markup/sanitizer.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go
index 0ebb3ff88b..f7789a9e56 100644
--- a/modules/markup/sanitizer.go
+++ b/modules/markup/sanitizer.go
@@ -50,6 +50,15 @@ func ReplaceSanitizer() {
// Allow <kbd> tags for keyboard shortcut styling
sanitizer.policy.AllowElements("kbd")
+
+ // Custom keyword markup
+ for _, rule := range setting.ExternalSanitizerRules {
+ if rule.Regexp != nil {
+ sanitizer.policy.AllowAttrs(rule.AllowAttr).Matching(rule.Regexp).OnElements(rule.Element)
+ } else {
+ sanitizer.policy.AllowAttrs(rule.AllowAttr).OnElements(rule.Element)
+ }
+ }
}
// Sanitize takes a string that contains a HTML fragment or document and applies policy whitelist.