Commit 601c8ab70e36d7f5eb04566eb8c531a776b5eff8

Martin Mitas 2024-01-08T19:06:04

Restore parent's block indentation when interruping a list item with double blank line. Fixes #190.

diff --git a/src/md4c.c b/src/md4c.c
index 9178327..b433f76 100644
--- a/src/md4c.c
+++ b/src/md4c.c
@@ -5913,8 +5913,13 @@ md_analyze_line(MD_CTX* ctx, OFF beg, OFF* p_end,
                    ctx->n_block_bytes > (int) sizeof(MD_BLOCK))
                 {
                     MD_BLOCK* top_block = (MD_BLOCK*) ((char*)ctx->block_bytes + ctx->n_block_bytes - sizeof(MD_BLOCK));
-                    if(top_block->type == MD_BLOCK_LI)
+                    if(top_block->type == MD_BLOCK_LI) {
                         n_parents--;
+
+                        line->indent = total_indent;
+                        if(n_parents > 0)
+                            line->indent -= ctx->containers[n_parents-1].contents_indent;
+                    }
                 }
 
                 ctx->last_list_item_starts_with_two_blank_lines = FALSE;
diff --git a/test/coverage.txt b/test/coverage.txt
index 66d5cc8..de8862d 100644
--- a/test/coverage.txt
+++ b/test/coverage.txt
@@ -324,6 +324,21 @@ bar
 ````````````````````````````````
 
 
+### [Issue 190](https://github.com/mity/md4c/issues/190)
+
+```````````````````````````````` example
+-
+
+    foo
+.
+<ul>
+<li></li>
+</ul>
+<pre><code>foo
+</code></pre>
+````````````````````````````````
+
+
 ## Code coverage
 
 ### `md_is_unicode_whitespace__()`