Commit f9b4cb8f6e33d04b9940cb6e77ea6987e1888b88

Martin Mitas 2016-12-15T16:47:41

md_process_inlines: Fix when an expanded mark shadows some nested marks (issue #11).

diff --git a/md4c/md4c.c b/md4c/md4c.c
index a7b0491..ef92e69 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -3535,7 +3535,7 @@ md_process_inlines(MD_CTX* ctx, const MD_LINE* lines, int n_lines)
             /* Move to next resolved mark. */
             prev_mark = mark;
             mark++;
-            while(!(mark->flags & MD_MARK_RESOLVED))
+            while(!(mark->flags & MD_MARK_RESOLVED)  ||  mark->beg < off)
                 mark++;
         }
 
diff --git a/test/coverage.txt b/test/coverage.txt
index f4fb235..619fb7d 100644
--- a/test/coverage.txt
+++ b/test/coverage.txt
@@ -79,6 +79,13 @@ x
 </ul>
 ````````````````````````````````
 
+### [Issue 11](https://github.com/mity/md4c/issues/11)
+```````````````````````````````` example
+x [link](/url "foo &ndash; bar") x
+.
+<p>x <a href="/url" title="foo – bar">link</a> x</p>
+````````````````````````````````
+
 
 ## Code coverage