aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-01-20 00:23:35 +0000
committertechknowlogick <techknowlogick@gitea.io>2020-01-19 19:23:35 -0500
commitf2e9d4b85108e29f13e3a2f3425e77f7ec3dec7c (patch)
tree4b47c2f523960774e17db2bd0e880e185eff526d
parente878d743f49fc48c603ace90c9b9343814ae31ec (diff)
downloadgitea-f2e9d4b85108e29f13e3a2f3425e77f7ec3dec7c.tar.gz
gitea-f2e9d4b85108e29f13e3a2f3425e77f7ec3dec7c.zip
Allow hyphen in language name (#9873) (#9880)
Co-authored-by: techknowlogick <matti@mdranta.net>
-rw-r--r--modules/markup/sanitizer.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go
index d135d41966..5158e67c2a 100644
--- a/modules/markup/sanitizer.go
+++ b/modules/markup/sanitizer.go
@@ -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")