Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion html2text.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func HTML2Text(html string) string {
outBuf.WriteString("\r\n")
} else if tagName == "p" || tagName == "/p" {
if canPrintNewline {
outBuf.WriteString("\r\n")
outBuf.WriteString("\r\n\r\n")
}
canPrintNewline = false
} else if badTagnamesRE.MatchString(tagName) {
Expand Down
2 changes: 1 addition & 1 deletion html2text_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestHTML2Text(t *testing.T) {
Convey("Line breaks", func() {
So(HTML2Text("should \nignore \r\nnew lines"), ShouldEqual, "should ignore new lines")
So(HTML2Text(`two<br>line<br/>breaks`), ShouldEqual, "two\r\nline\r\nbreaks")
So(HTML2Text(`<p>two</p><p>paragraphs</p>`), ShouldEqual, "two\r\nparagraphs")
So(HTML2Text(`<p>two</p><p>paragraphs</p>`), ShouldEqual, "two\r\n\r\nparagraphs")
})

Convey("HTML entities", func() {
Expand Down