mirror of
https://gitee.com/gitea/gitea.git
synced 2024-12-16 15:41:11 +08:00
Allow hyphen in language name (#9873)
This commit is contained in:
parent
fb8aea4eeb
commit
948dec3d75
@ -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…
Reference in New Issue
Block a user