Allow hyphen in language name (#9873) (#9880)

Co-authored-by: techknowlogick <matti@mdranta.net>
This commit is contained in:
zeripath
2020-01-19 19:23:35 -05:00
committed by techknowlogick
co-authored by techknowlogick
parent e878d743f4
commit f2e9d4b851
+1 -1
View File
@@ -38,7 +38,7 @@ func NewSanitizer() {
func ReplaceSanitizer() { func ReplaceSanitizer() {
sanitizer.policy = bluemonday.UGCPolicy() sanitizer.policy = bluemonday.UGCPolicy()
// We only want to allow HighlightJS specific classes for code blocks // We only want to allow HighlightJS specific classes for code blocks
sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`^language-\w+$`)).OnElements("code") sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`^language-[\w-]+$`)).OnElements("code")
// Checkboxes // Checkboxes
sanitizer.policy.AllowAttrs("type").Matching(regexp.MustCompile(`^checkbox$`)).OnElements("input") sanitizer.policy.AllowAttrs("type").Matching(regexp.MustCompile(`^checkbox$`)).OnElements("input")