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: When @ someone, markdown render error
sy-records41691eed2fb6
diff --git a/pkg/converter/markdown.go b/pkg/converter/markdown.goindex e537f554..af17d9bd 100644--- a/pkg/converter/markdown.go+++ b/pkg/converter/markdown.go@@ -98,7 +98,6 @@ func (r *DangerousHTMLRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisreg.Register(ast.KindRawHTML, r.renderRawHTML)reg.Register(ast.KindLink, r.renderLink)reg.Register(ast.KindAutoLink, r.renderAutoLink)-}func (r *DangerousHTMLRenderer) renderRawHTML(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) {@@ -136,7 +135,6 @@ func (r *DangerousHTMLRenderer) renderHTMLBlock(w util.BufWriter, source []byte,}func (r *DangerousHTMLRenderer) renderLink(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) {-n := node.(*ast.Link)if entering && r.renderLinkIsUrl(string(n.Destination)) {_, _ = w.WriteString("<a href=\"")@@ -186,5 +184,7 @@ func (r *DangerousHTMLRenderer) renderAutoLink(w util.BufWriter, source []byte,}func (r *DangerousHTMLRenderer) renderLinkIsUrl(verifyUrl string) bool {- return govalidator.IsURL(verifyUrl)+ isURL := govalidator.IsURL(verifyUrl)+ isPath, _ := regexp.MatchString(`^/`, verifyUrl)+ return isURL || isPath}diff --git a/ui/src/components/Mentions/index.tsx b/ui/src/components/Mentions/index.tsxindex ae5ea2ff..662ffc97 100644--- a/ui/src/components/Mentions/index.tsx+++ b/ui/src/components/Mentions/index.tsx@@ -107,7 +107,7 @@ const Mentions: FC<IProps> = ({ children, pageUsers, onSelected }) => {return;}- const text = `@${item?.userName}`;+ const text = `@${item?.userName} `;onSelected(`${value.substring(0,diff --git a/ui/src/utils/common.ts b/ui/src/utils/common.tsindex 97880bf7..0644eba2 100644--- a/ui/src/utils/common.ts+++ b/ui/src/utils/common.ts@@ -118,7 +118,7 @@ function matchedUsers(markdown) {*/function parseUserInfo(markdown) {const globalReg = /\B@([\w\\_\\.\\-]+)/g;- return markdown.replace(globalReg, '[@$1](/u/$1)');+ return markdown.replace(globalReg, '[@$1](/users/$1)');}function parseEditMentionUser(markdown) {