From 583b3c5e1dcb22f284b040675c11024081a4a66c Mon Sep 17 00:00:00 2001 From: Russ Ross Date: Fri, 9 Sep 2011 12:30:45 -0600 Subject: [PATCH] fixed bug with blank line handling within list items --- block.go | 8 +++++++- block_test.go | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/block.go b/block.go index af0eb78..8f68954 100644 --- a/block.go +++ b/block.go @@ -1079,10 +1079,16 @@ gatherlines: *flags |= LIST_ITEM_CONTAINS_BLOCK } - containsBlankLine = false + // if this line was preceeded by one or more blanks, + // re-introduce the blank into the buffer + if containsBlankLine { + containsBlankLine = false + raw.WriteByte('\n') + } // add the line into the working buffer without prefix raw.Write(data[line+indent : i]) + line = i } diff --git a/block_test.go b/block_test.go index e169900..75296bd 100644 --- a/block_test.go +++ b/block_test.go @@ -396,6 +396,9 @@ func TestUnorderedList(t *testing.T) { "* List\n\n code block with spaces\n", "\n", + + "* List\n\n * sublist\n\n normal text\n\n * another sublist\n", + "\n", } doTestsBlock(t, tests, 0) }