Allow hyphen in language name (#9873)

tokarchuk/v1.17
zeripath 5 years ago committed by GitHub
parent fb8aea4eeb
commit 948dec3d75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      modules/markup/sanitizer.go

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

Loading…
Cancel
Save