diff --git a/src/rules.ts b/src/rules.ts index c9bc07c5d6..80fbaa5092 100644 --- a/src/rules.ts +++ b/src/rules.ts @@ -177,8 +177,10 @@ const createParagraph = (listInterrupt: RegExp) => edit(_paragraph) // only non-empty lists starting from 1 can interrupt paragraphs const paragraph = createParagraph(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/); -// blockquotes can be interrupted by lists starting from any number -const blockquoteParagraph = createParagraph(/ {0,3}(?:[*+-]|\d{1,9}[.)])[ \t]+[^ \t\n]/); +// inside a blockquote a bare list marker (any number) starts a sibling list, +// so it must not be lazily continued as paragraph text (unlike a top level +// paragraph, where an empty list cannot interrupt) +const blockquoteParagraph = createParagraph(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/); const blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/) .replace('paragraph', blockquoteParagraph) diff --git a/test/specs/new/empty_list_after_blockquote.html b/test/specs/new/empty_list_after_blockquote.html new file mode 100644 index 0000000000..0ea2962633 --- /dev/null +++ b/test/specs/new/empty_list_after_blockquote.html @@ -0,0 +1,13 @@ +
+

foo

+
+ +
+

foo +bar

+
+
    +
  1. +
diff --git a/test/specs/new/empty_list_after_blockquote.md b/test/specs/new/empty_list_after_blockquote.md new file mode 100644 index 0000000000..33ee472888 --- /dev/null +++ b/test/specs/new/empty_list_after_blockquote.md @@ -0,0 +1,6 @@ +> foo +- + +> foo +> bar +1.