diff --git a/src/Tokenizer.ts b/src/Tokenizer.ts index 3ee78c52..87090e17 100644 --- a/src/Tokenizer.ts +++ b/src/Tokenizer.ts @@ -285,6 +285,13 @@ export class _Tokenizer { raw = `${raw}\n${consumed.join('\n')}`; } text = text.substring(0, text.length - oldToken.text.length) + newToken.text; + + // A leftover line that starts with '>' still belongs to this + // blockquote; any other leftover line ends it. + lines = lines.slice(consumed.length); + if (lines.length > 0 && this.rules.other.blockquoteStart.test(lines[0])) { + continue; + } break; } else if (lastToken?.type === 'list') { // include continuation in nested list diff --git a/test/specs/new/blockquote_nested_lazy_outer_continuation.html b/test/specs/new/blockquote_nested_lazy_outer_continuation.html new file mode 100644 index 00000000..40a26c78 --- /dev/null +++ b/test/specs/new/blockquote_nested_lazy_outer_continuation.html @@ -0,0 +1,30 @@ +
+
+

a +b

+
+

c

+
+
+
+

a +b

+
+

heading

+
+
+
+

a +b

+
+
+
+
+
+

a +b

+
+ +
diff --git a/test/specs/new/blockquote_nested_lazy_outer_continuation.md b/test/specs/new/blockquote_nested_lazy_outer_continuation.md new file mode 100644 index 00000000..7a19e8c1 --- /dev/null +++ b/test/specs/new/blockquote_nested_lazy_outer_continuation.md @@ -0,0 +1,16 @@ +> > a +b +> +> c + +> > a +b +> # heading + +> > a +b +> --- + +> > a +b +> - item