This is an automated email from the ASF dual-hosted git repository. linkinstar pushed a commit to branch dev in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
commit 6203b5b44192d214e15de3d84662742de27ac840 Author: Luffy <[email protected]> AuthorDate: Wed Dec 11 16:37:29 2024 +0800 fix: use TrimSpace --- pkg/converter/markdown.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/converter/markdown.go b/pkg/converter/markdown.go index 5dbab9fc..eb121c01 100644 --- a/pkg/converter/markdown.go +++ b/pkg/converter/markdown.go @@ -22,6 +22,7 @@ package converter import ( "bytes" "regexp" + "strings" "github.com/asaskevich/govalidator" "github.com/microcosm-cc/bluemonday" @@ -61,7 +62,7 @@ func Markdown2HTML(source string) string { filter.AllowElements("kbd") filter.AllowAttrs("title").Matching(regexp.MustCompile(`^[\p{L}\p{N}\s\-_',\[\]!\./\\\(\)]*$|^@embed?$`)).Globally() filter.AllowAttrs("start").OnElements("ol") - html = filter.Sanitize(html) + html = strings.TrimSpace(filter.Sanitize(html)) return html }
