cmark

My personal build of CMark ✏️

Commit
c56aa1514f04a5e369b35e92cf56186575a40af1
Parent
732207b00176856dd8101a27e8d31a90926fa4da
Author
John MacFarlane <jgm@berkeley.edu>
Date

Allow empty `<>` link destination in reference link.

Diffstat

1 file changed, 7 insertions, 4 deletions

Status File Name N° Changes Insertions Deletions
Modified src/inlines.c 11 7 4
diff --git a/src/inlines.c b/src/inlines.c
@@ -938,10 +938,14 @@ static bufsize_t manual_scan_link_url_2(cmark_chunk *input, bufsize_t offset,
           break;
         --nb_p;
         ++i;
-      } else if (cmark_isspace(input->data[i]))
+      } else if (cmark_isspace(input->data[i])) {
+        if (i == offset) {
+	  return -1;
+	}
         break;
-      else
+      } else {
         ++i;
+      }
     }
 
   if (i >= input->len)
@@ -1337,8 +1341,7 @@ bufsize_t cmark_parse_reference_inline(cmark_mem *mem, cmark_chunk *input,
 
   // parse link url:
   spnl(&subj);
-  if ((matchlen = manual_scan_link_url(&subj.input, subj.pos, &url)) > -1 &&
-      url.len > 0) {
+  if ((matchlen = manual_scan_link_url(&subj.input, subj.pos, &url)) > -1) {
     subj.pos += matchlen;
   } else {
     return 0;