Skip to content

Commit 948dec3

Browse files
authored
Allow hyphen in language name (#9873)
1 parent fb8aea4 commit 948dec3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/markup/sanitizer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func NewSanitizer() {
3838
func ReplaceSanitizer() {
3939
sanitizer.policy = bluemonday.UGCPolicy()
4040
// We only want to allow HighlightJS specific classes for code blocks
41-
sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`^language-\w+$`)).OnElements("code")
41+
sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`^language-[\w-]+$`)).OnElements("code")
4242

4343
// Checkboxes
4444
sanitizer.policy.AllowAttrs("type").Matching(regexp.MustCompile(`^checkbox$`)).OnElements("input")

0 commit comments

Comments
 (0)