Commit eb6a221e22f2b87232ff464f88a0102228dfc019

Martin Mitas 2019-03-26T11:58:17

md_is_opening_code_fence: Allow backtick... ... in info string of tilde-based fence.

diff --git a/md4c/md4c.c b/md4c/md4c.c
index f9a3e0a..b2a8580 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -5048,11 +5048,13 @@ md_is_opening_code_fence(MD_CTX* ctx, OFF beg, OFF* p_end)
     while(off < ctx->size  &&  CH(off) == _T(' '))
         off++;
 
-    /* Optionally, an info string can follow. It must not contain '`'. */
-    while(off < ctx->size  &&  CH(off) != _T('`')  &&  !ISNEWLINE(off))
+    /* Optionally, an info string can follow. */
+    while(off < ctx->size  &&  !ISNEWLINE(off)) {
+        /* Backtick-based fence must not contain '`' in the info string. */
+        if(CH(beg) == _T('`')  &&  CH(off) == _T('`'))
+            return FALSE;
         off++;
-    if(off < ctx->size  &&  !ISNEWLINE(off))
-        return FALSE;
+    }
 
     *p_end = off;
     return TRUE;