Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: use TrimSpace

Luffy6203b5b44192
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
}