Allow kbd tags (#9245)

* Allow kbd tags

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Add test

Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
John Olheiser 2019-12-03 13:02:41 -06:00 committed by techknowlogick
parent bdbdd6608f
commit 9a33adcdd3
2 changed files with 6 additions and 0 deletions

View file

@ -47,6 +47,9 @@ func ReplaceSanitizer() {
// Allow keyword markup
sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`^` + keywordClass + `$`)).OnElements("span")
// Allow <kbd> tags for keyboard shortcut styling
sanitizer.policy.AllowElements("kbd")
}
// Sanitize takes a string that contains a HTML fragment or document and applies policy whitelist.