1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-15 15:07:20 +00:00

Fix code block style for code preview (#30298) (#30306)

Backport #30298 by wxiaoguang

Fix #30292

To avoid unnecessary style overriding, use "div" instead of "code"

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Giteabot
2024-04-06 20:34:38 +08:00
committed by GitHub
parent 02bf0a8cd7
commit 45e8a884b8
4 changed files with 6 additions and 6 deletions

View File

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