diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go index 77fbdf4520..570a1da248 100644 --- a/modules/markup/sanitizer.go +++ b/modules/markup/sanitizer.go @@ -65,7 +65,7 @@ func createDefaultPolicy() *bluemonday.Policy { policy.AllowAttrs("class").Matching(regexp.MustCompile(`^lines-num$`)).OnElements("td") policy.AllowAttrs("data-line-number").OnElements("span") policy.AllowAttrs("class").Matching(regexp.MustCompile(`^lines-code chroma$`)).OnElements("td") - policy.AllowAttrs("class").Matching(regexp.MustCompile(`^code-inner$`)).OnElements("code") + policy.AllowAttrs("class").Matching(regexp.MustCompile(`^code-inner$`)).OnElements("div") // For code preview (unicode escape) policy.AllowAttrs("class").Matching(regexp.MustCompile(`^file-view( unicode-escaped)?$`)).OnElements("table") diff --git a/services/markup/processorhelper_codepreview_test.go b/services/markup/processorhelper_codepreview_test.go index 01db792925..154e4e8e44 100644 --- a/services/markup/processorhelper_codepreview_test.go +++ b/services/markup/processorhelper_codepreview_test.go @@ -36,10 +36,10 @@ func TestProcessorHelperCodePreview(t *testing.T) {
- | # repo1 |
+ # repo1 |
- |
|
+
- | # repo1 |
+ # repo1 |
{{$line.FormattedContent}}