Commit 609dfb0b1ec87e245ff8ad80f940f5263c42f6fb

Martin Mitas 2019-05-05T15:56:51

md_analyze_line: Treat blank lines inside a HTML block more carefully... ... with respect to the parent list containers. Fixes #10 (but now really).

diff --git a/md4c/md4c.c b/md4c/md4c.c
index 996d194..4527242 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -5548,6 +5548,15 @@ redo:
             }
         }
 
+        if(off >= ctx->size  ||  ISNEWLINE(off)) {
+            /* Blank line does not need any real indentation to be nested inside
+             * a list. */
+            if(n_brothers + n_children == 0) {
+                while(n_parents < ctx->n_containers  &&  ctx->containers[n_parents].ch != _T('>'))
+                    n_parents++;
+            }
+        }
+
         if(n_parents == ctx->n_containers) {
             line->type = MD_LINE_HTML;
             goto done;
diff --git a/test/coverage.txt b/test/coverage.txt
index c7dc4ac..64b4678 100644
--- a/test/coverage.txt
+++ b/test/coverage.txt
@@ -74,7 +74,8 @@ x
 .
 <ul>
 <li><?
-<p>x</p>
+
+x
 </li>
 </ul>
 ````````````````````````````````