Skip to content

Commit

Permalink
Fix yuin#416
Browse files Browse the repository at this point in the history
  • Loading branch information
yuin authored and persuader72 committed Apr 19, 2024
1 parent d1a2847 commit 2d2e071
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions _test/extra.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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>
//= = = = = = = = = = = = = = = = = = = = = = = =//
3 changes: 3 additions & 0 deletions renderer/html/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down

0 comments on commit 2d2e071

Please sign in to comment.