From 68cfb8c0792ba87992d21ffb4d22ee6cf635afb7 Mon Sep 17 00:00:00 2001 From: wheelman Date: Fri, 22 May 2026 15:30:18 +0530 Subject: [PATCH] fix: don't end HTML comment blocks on a blank line (#1155) HTML blocks of types 1-5 (e.g. `` for comments), per CommonMark. Only types 6 and 7 end on a blank line. The block scanner broke out of the continuation loop whenever a line was outdented below the current block indent. Inside a container such as a list item, a blank line is outdented (its sCount is 0), so a comment block was terminated early instead of running to `-->`. Skip that break for outdented blank lines unless the block type actually ends on a blank line, so comment blocks no longer depend on indentation. Adds regression fixtures for issue #1144. Co-authored-by: ATOM00blue <219721791+ATOM00blue@users.noreply.github.com> --- lib/rules_block/html_block.mjs | 13 +++++- .../markdown-it/commonmark_extras.txt | 43 +++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/lib/rules_block/html_block.mjs b/lib/rules_block/html_block.mjs index 197520f..d051e59 100644 --- a/lib/rules_block/html_block.mjs +++ b/lib/rules_block/html_block.mjs @@ -42,11 +42,22 @@ export default function html_block (state, startLine, endLine, silent) { let nextLine = startLine + 1 + // Block types 6 and 7 (the only ones whose end condition is a blank line) + // have `/^$/` as their closing regexp. For all other types (1-5, e.g. + // ` + c +. +
    +
  1. +

    item

    + +

    c

    +
  2. +
+. + +Issue #1144. Comment HTML block spanning a blank line inside a blockquote +. +> +> c +. +
+ +

c

+
+.