diff --git a/block.go b/block.go index 7fb472e..740ad46 100644 --- a/block.go +++ b/block.go @@ -1153,6 +1153,7 @@ gatherlines: // and move on to the next line if p.isEmpty(data[line:i]) > 0 { containsBlankLine = true + raw.Write(data[line:i]) line = i continue } @@ -1220,17 +1221,10 @@ gatherlines: // a blank line means this should be parsed as a block case containsBlankLine: - raw.WriteByte('\n') *flags |= LIST_ITEM_CONTAINS_BLOCK } - // if this line was preceeded by one or more blanks, - // re-introduce the blank into the buffer - if containsBlankLine { - containsBlankLine = false - raw.WriteByte('\n') - - } + containsBlankLine = false // add the line into the working buffer without prefix raw.Write(data[line+indent : i]) diff --git a/block_test.go b/block_test.go index 60da6ca..f59268e 100644 --- a/block_test.go +++ b/block_test.go @@ -702,10 +702,41 @@ func TestUnorderedList(t *testing.T) { "* List\n\n * sublist\n\n normal text\n\n * another sublist\n", "\n", + + `* Foo + + bar + + qux +`, + ` +`, } doTestsBlock(t, tests, 0) } +func TestFencedCodeBlockWithinList(t *testing.T) { + doTestsBlock(t, []string{ + "* Foo\n\n ```\n bar\n\n qux\n ```\n", + ` +`, + }, EXTENSION_FENCED_CODE) +} + func TestOrderedList(t *testing.T) { var tests = []string{ "1. Hello\n", @@ -798,6 +829,26 @@ func TestOrderedList(t *testing.T) { "1. numbers\n1. are ignored\n", "
    \n
  1. numbers
  2. \n
  3. are ignored
  4. \n
\n", + + `1. Foo + + bar + + + + qux +`, + `
    +
  1. Foo

    + +
    bar
    +
    +
    +
    +qux
    +
  2. +
+`, } doTestsBlock(t, tests, 0) }