diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go index 77fbdf4520fc6..570a1da248094 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 01db792925e30..154e4e8e44118 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}}