Skip to content

Commit

Permalink
Allow hyphen in language name (#9873) (#9880)
Browse files Browse the repository at this point in the history
Co-authored-by: techknowlogick <matti@mdranta.net>
  • Loading branch information
zeripath and techknowlogick committed Jan 20, 2020
1 parent e878d74 commit f2e9d4b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/markup/sanitizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit f2e9d4b

Please sign in to comment.