update markdown

This commit is contained in:
aichy126 2023-04-07 18:26:46 +08:00
parent 60fcd74805
commit a5a57a343b
1 changed files with 3 additions and 0 deletions

View File

@ -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)))
} }