mirror of https://gitee.com/answerdev/answer.git
update markdown
This commit is contained in:
parent
60fcd74805
commit
a5a57a343b
|
@ -35,6 +35,8 @@ func Markdown2HTML(source string) string {
|
||||||
html := buf.String()
|
html := buf.String()
|
||||||
filter := bluemonday.UGCPolicy()
|
filter := bluemonday.UGCPolicy()
|
||||||
filter.AllowStyling()
|
filter.AllowStyling()
|
||||||
|
filter.RequireNoFollowOnLinks(false)
|
||||||
|
filter.RequireParseableURLs(false)
|
||||||
html = filter.Sanitize(html)
|
html = filter.Sanitize(html)
|
||||||
return html
|
return html
|
||||||
}
|
}
|
||||||
|
@ -111,6 +113,7 @@ func (r *DangerousHTMLRenderer) renderLink(w util.BufWriter, source []byte, node
|
||||||
n := node.(*ast.Link)
|
n := node.(*ast.Link)
|
||||||
if entering && r.renderLinkIsUrl(string(n.Destination)) {
|
if entering && r.renderLinkIsUrl(string(n.Destination)) {
|
||||||
_, _ = w.WriteString("<a href=\"")
|
_, _ = w.WriteString("<a href=\"")
|
||||||
|
// _, _ = w.WriteString("<a test=\"1\" rel=\"nofollow\" href=\"")
|
||||||
if r.Unsafe || !html.IsDangerousURL(n.Destination) {
|
if r.Unsafe || !html.IsDangerousURL(n.Destination) {
|
||||||
_, _ = w.Write(util.EscapeHTML(util.URLEscape(n.Destination, true)))
|
_, _ = w.Write(util.EscapeHTML(util.URLEscape(n.Destination, true)))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue