Browse Source

Allow hyphen in language name (#9873)

tags/v1.12.0-dev
zeripath GitHub 5 years ago
parent
commit
3f3d808e77
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      modules/markup/sanitizer.go

+ 1
- 1
modules/markup/sanitizer.go View File

@@ -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")


Loading…
Cancel
Save