Commit 4bb7cf8a4b4288c09ca4d5935a51091bd57b980d

Martin Mitas 2016-11-26T23:02:44

Fix handling a backslash inside an autolink. This fixes this: <http://example.com/\[\>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/md4c/md4c.c b/md4c/md4c.c
index 5fbe224..96b00d5 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -2219,9 +2219,10 @@ md_collect_marks(MD_CTX* ctx, const MD_LINE* lines, int n_lines)
                 if(!ISNEWLINE(off+1)  ||  i+1 < n_lines)
                     PUSH_MARK(ch, off, off+2, MD_MARK_RESOLVED);
 
-                /* If '`' follows, we need both marks as the backslash may be
-                 * inside a code span. */
-                if(CH(off+1) == _T('`'))
+                /* If '`' or '>' follows, we need both marks as the backslash
+                 * may be inside a code span or an autolink where escaping is
+                 * disabled. */
+                if(CH(off+1) == _T('`') || CH(off+1) == _T('>'))
                     off++;
                 else
                     off += 2;