Commit 5592352fdbeaee99eb78a2052a9fc7c6016f8783

Martin Mitas 2024-01-13T00:30:08

HTML declaration doesn't require whitespace before the closer. Fixes #216.

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 17fabe1..bc93ee4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,7 +15,7 @@ Changes:
 
    - HTML declaration (HTML block type 4) is not required to begin with an
      upper-case ASCII character after the `<!`. Any ASCII character is now
-     allowed.
+     allowed. Also it now doesn't require a whitespace before the closing `>`.
 
    Other than that, the newest specification mainly improves test coverage and
    clarifies its wording in some cases, without affecting the implementation.
diff --git a/src/md4c.c b/src/md4c.c
index 4842ed9..e25d266 100644
--- a/src/md4c.c
+++ b/src/md4c.c
@@ -1229,8 +1229,6 @@ md_is_html_declaration(MD_CTX* ctx, const MD_LINE* lines, int n_lines, OFF beg, 
     off++;
     while(off < lines[0].end  &&  ISALPHA(off))
         off++;
-    if(off < lines[0].end  &&  !ISWHITESPACE(off))
-        return FALSE;
 
     return md_scan_for_html_closer(ctx, _T(">"), 1,
                 lines, n_lines, off, max_end, p_end, &ctx->html_decl_horizon);
diff --git a/test/coverage.txt b/test/coverage.txt
index 9970e5f..1d4fdf5 100644
--- a/test/coverage.txt
+++ b/test/coverage.txt
@@ -411,6 +411,15 @@ title
 ````````````````````````````````
 
 
+### [Issue 216](https://github.com/mity/md4c/issues/216)
+
+```````````````````````````````` example
+x <!A>
+.
+<p>x <!A></p>
+````````````````````````````````
+
+
 ## Code coverage
 
 ### `md_is_unicode_whitespace__()`