This commit is contained in:
yuin 2023-10-14 18:02:09 +09:00
parent 68e53654f2
commit 6442ae1259
2 changed files with 12 additions and 0 deletions

View file

@ -771,3 +771,12 @@ a <!-- b -->
<p>&lt;img src=./.assets/logo.svg</p>
<p>/&gt;</p>
//= = = = = = = = = = = = = = = = = = = = = = = =//
61: Image alt with a new line
//- - - - - - - - -//
![alt
text](logo.png)
//- - - - - - - - -//
<p><img src="logo.png" alt="alt
text" /></p>
//= = = = = = = = = = = = = = = = = = = = = = = =//

View file

@ -938,6 +938,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))
}