russross / blackfriday

Blackfriday: a markdown processor for Go
Other
5.45k stars 602 forks source link

List after paragraph not rendenring #684

Closed rafaeljusto closed 3 years ago

rafaeljusto commented 3 years ago

Hi 👋

Thanks for this amazing library!

When adding some text, followed by a list looks like the conversion is failing.

Input

text
* item1
* item2
* item3

Expected

<p>text</p>
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>

Got

<p>text
* item1
* item2
* item3</p>

Is this the expected behavior? I've added the following test scenario to replicate the issue:

diff --git a/markdown_test.go b/markdown_test.go
index d897644..4b50ab4 100644
--- a/markdown_test.go
+++ b/markdown_test.go
@@ -70,6 +70,10 @@ func TestDocument(t *testing.T) {
                // https://github.com/russross/blackfriday/issues/173
                "   [",
                "<p>[</p>\n",
+
+               // List not being converted
+               "text\n* item1\n* item2\n* item3",
+               "<p>text</p>\n<ul>\n<li>item1</li>\n<li>item2</li>\n<li>item3</li>\n</ul>",
        }
        doTests(t, tests)
 }

And I'm getting a failing message:

--- FAIL: TestDocument (0.00s)
    markdown_test.go:39: 
        Input   ["text\n* item1\n* item2\n* item3"]
        Expected["<p>text</p>\n<ul>\n<li>item1</li>\n<li>item2</li>\n<li>item3</li>\n</ul>"]
        Actual  ["<p>text\n* item1\n* item2\n* item3</p>\n"]
rafaeljusto commented 3 years ago

Never mind. The above works when using the extension blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK.

Thanks!