Commit bf022cb6569457598fb37b266a4129d1aa01211b

Martin Mitas 2018-05-28T21:14:45

Fix md_split_simple_pairing_mark(). When splitting a mark into two, make sure each of them gets the right share od dummies for case that we will have to split once more. Fixes #36.

diff --git a/md4c/md4c.c b/md4c/md4c.c
index e6b2b94..1b75c3c 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -3490,7 +3490,7 @@ static int
 md_split_simple_pairing_mark(MD_CTX* ctx, int mark_index, SZ n)
 {
     MD_MARK* mark = &ctx->marks[mark_index];
-    int new_mark_index = mark_index + (mark->end - mark->beg - 1);
+    int new_mark_index = mark_index + (mark->end - mark->beg - n);
     MD_MARK* dummy = &ctx->marks[new_mark_index];
 
     MD_ASSERT(mark->end - mark->beg > n);
diff --git a/test/coverage.txt b/test/coverage.txt
index 528069b..6a622d8 100644
--- a/test/coverage.txt
+++ b/test/coverage.txt
@@ -123,7 +123,14 @@ a*b**c*
 ```&&&&&&&&
 .
 <pre><code class="language-&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;"></code></pre>
+````````````````````````````````
+
 
+### [Issue 36](https://github.com/mity/md4c/issues/36)
+```````````````````````````````` example
+__x_ _x___
+.
+<p><em><em>x</em> <em>x</em></em>_</p>
 ````````````````````````````````