From 58da585b7ebfd6dbe600d52044d08d7340c2703f Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 30 Oct 2025 03:11:19 +0100 Subject: [PATCH] allow data-line-number on markup sanitizer --- modules/markup/sanitizer_default.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/markup/sanitizer_default.go b/modules/markup/sanitizer_default.go index 0fbf0f0b24..7fdf66c4bc 100644 --- a/modules/markup/sanitizer_default.go +++ b/modules/markup/sanitizer_default.go @@ -30,6 +30,9 @@ func (st *Sanitizer) createDefaultPolicy() *bluemonday.Policy { // Chroma always uses 1-2 letters for style names, we could tolerate it at the moment policy.AllowAttrs("class").Matching(regexp.MustCompile(`^\w{0,2}$`)).OnElements("span") + // Line numbers on codepreview + policy.AllowAttrs("data-line-number").OnElements("span") + // Custom URL-Schemes if len(setting.Markdown.CustomURLSchemes) > 0 { policy.AllowURLSchemes(setting.Markdown.CustomURLSchemes...)