Commit 7497ea92b3e640ea216e135254e0f0d810890d90

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

Allow tabs after setext header underline. Fixes #215.

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2e7629c..17fabe1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -98,6 +98,10 @@ Fixes:
  * [#214](https://github.com/mity/md4c/issues/214):
    Tags `<h2>` ... `<h6>` incorrectly did not trigger HTML block.
 
+ * [#215](https://github.com/mity/md4c/issues/215):
+   The parser incorrectly did not accept optional tabs after setext header
+   underline.
+
 
 ## Version 0.4.8
 
diff --git a/src/md4c.c b/src/md4c.c
index 15e9bd2..4842ed9 100644
--- a/src/md4c.c
+++ b/src/md4c.c
@@ -5216,8 +5216,8 @@ md_is_setext_underline(MD_CTX* ctx, OFF beg, OFF* p_end, unsigned* p_level)
     while(off < ctx->size  &&  CH(off) == CH(beg))
         off++;
 
-    /* Optionally, space(s) can follow. */
-    while(off < ctx->size  &&  CH(off) == _T(' '))
+    /* Optionally, space(s) or tabs can follow. */
+    while(off < ctx->size  &&  ISBLANK(off))
         off++;
 
     /* But nothing more is allowed on the line. */
diff --git a/test/coverage.txt b/test/coverage.txt
index 27e35dd..9970e5f 100644
--- a/test/coverage.txt
+++ b/test/coverage.txt
@@ -401,6 +401,16 @@ _bar_
 ````````````````````````````````
 
 
+### [Issue 215](https://github.com/mity/md4c/issues/215)
+
+```````````````````````````````` example
+title
+--→
+.
+<h2>title</h2>
+````````````````````````````````
+
+
 ## Code coverage
 
 ### `md_is_unicode_whitespace__()`