From f2e9d4b85108e29f13e3a2f3425e77f7ec3dec7c Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 20 Jan 2020 00:23:35 +0000 Subject: [PATCH] Allow hyphen in language name (#9873) (#9880) Co-authored-by: techknowlogick --- modules/markup/sanitizer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go index d135d4196..5158e67c2 100644 --- a/modules/markup/sanitizer.go +++ b/modules/markup/sanitizer.go @@ -38,7 +38,7 @@ func NewSanitizer() { func ReplaceSanitizer() { sanitizer.policy = bluemonday.UGCPolicy() // 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 sanitizer.policy.AllowAttrs("type").Matching(regexp.MustCompile(`^checkbox$`)).OnElements("input")