Restore parent's block indentation when interruping a list item with double blank line. Fixes #190.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
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__()`