Fix HtmlBlockSyntax (dart-lang/markdown#548)
diff --git a/pkgs/markdown/lib/src/block_syntaxes/html_block_syntax.dart b/pkgs/markdown/lib/src/block_syntaxes/html_block_syntax.dart index ff00850..c1aa85c 100644 --- a/pkgs/markdown/lib/src/block_syntaxes/html_block_syntax.dart +++ b/pkgs/markdown/lib/src/block_syntaxes/html_block_syntax.dart
@@ -73,12 +73,9 @@ parser.advance(); } - // If the following lines start an HTML block again, put them together with - // current HTML block. - if (!parser.isDone && - parser.next != null && - pattern.hasMatch(parser.next!.content)) { - parser.advance(); + // If the current line start an HTML block again, put them together with + // the previous HTML block. + if (!parser.isDone && pattern.hasMatch(parser.current.content)) { lines.addAll(parseChildLines(parser)); }
diff --git a/pkgs/markdown/test/original/html_block.unit b/pkgs/markdown/test/original/html_block.unit new file mode 100644 index 0000000..f6b9216 --- /dev/null +++ b/pkgs/markdown/test/original/html_block.unit
@@ -0,0 +1,11 @@ +>>> issue https://github.com/dart-lang/markdown/issues/547 +<?code-excerpt ?> +```xml +<q> +</q> +``` +<<< +<?code-excerpt ?> +<pre><code class="language-xml"><q> +</q> +</code></pre> \ No newline at end of file