markup/goldmark: Sync image render hook code with Goldmark

Fixes #11681
This commit is contained in:
Joe Mooring 2023-11-07 19:47:15 -08:00 committed by Bjørn Erik Pedersen
parent 0bde6931ac
commit 805cc1773b

View file

@ -484,6 +484,9 @@ func nodeToHTMLText(n ast.Node, source []byte) []byte {
buf.Write(s.Text(source))
} else if !c.HasChildren() {
buf.Write(util.EscapeHTML(c.Text(source)))
if t, ok := c.(*ast.Text); ok && t.SoftLineBreak() {
buf.WriteByte('\n')
}
} else {
buf.Write(nodeToHTMLText(c, source))
}