Skip to content

Commit ff40519

Browse files
authored
Merge pull request #3 from TheBookPeople/paragraph-two-newlines
Add extra new line to separate paragraphs.
2 parents c09b98f + d001a4c commit ff40519

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

html2text.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func HTML2Text(html string) string {
171171
outBuf.WriteString("\r\n")
172172
} else if tagName == "p" || tagName == "/p" {
173173
if canPrintNewline {
174-
outBuf.WriteString("\r\n")
174+
outBuf.WriteString("\r\n\r\n")
175175
}
176176
canPrintNewline = false
177177
} else if badTagnamesRE.MatchString(tagName) {

html2text_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestHTML2Text(t *testing.T) {
2323
Convey("Line breaks", func() {
2424
So(HTML2Text("should \nignore \r\nnew lines"), ShouldEqual, "should ignore new lines")
2525
So(HTML2Text(`two<br>line<br/>breaks`), ShouldEqual, "two\r\nline\r\nbreaks")
26-
So(HTML2Text(`<p>two</p><p>paragraphs</p>`), ShouldEqual, "two\r\nparagraphs")
26+
So(HTML2Text(`<p>two</p><p>paragraphs</p>`), ShouldEqual, "two\r\n\r\nparagraphs")
2727
})
2828

2929
Convey("Headings", func() {

0 commit comments

Comments
 (0)