diff --git a/Render.go b/Render.go index 07e23e5..60570a8 100644 --- a/Render.go +++ b/Render.go @@ -58,6 +58,7 @@ func Render(markdown string) string { default: if len(line) == 0 { + flush() continue } diff --git a/Render_test.go b/Render_test.go index 74108d1..a50f3af 100644 --- a/Render_test.go +++ b/Render_test.go @@ -17,6 +17,7 @@ func TestParagraph(t *testing.T) { assert.Equal(t, markdown.Render("Text\n\n"), "

Text

") assert.Equal(t, markdown.Render("Text\n\n\n"), "

Text

") assert.Equal(t, markdown.Render("Line 1\nLine 2"), "

Line 1 Line 2

") + assert.Equal(t, markdown.Render("Line 1\n\nLine 2"), "

Line 1

Line 2

") } func TestHeader(t *testing.T) { @@ -38,6 +39,7 @@ func TestLink(t *testing.T) { } func TestCombined(t *testing.T) { + assert.Equal(t, markdown.Render("# Header\n\nLine 1."), "

Header

Line 1.

") assert.Equal(t, markdown.Render("# Header\nLine 1.\nLine 2.\nLine 3."), "

Header

Line 1. Line 2. Line 3.

") assert.Equal(t, markdown.Render("# Header 1\nLine 1.\n# Header 2\nLine 2."), "

Header 1

Line 1.

Header 2

Line 2.

") assert.Equal(t, markdown.Render("# [Header Link](https://example.com/)"), "

Header Link

")