diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-04-03 10:24:32 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-04-03 10:24:32 -0700 |
commit | c56aa1514f04a5e369b35e92cf56186575a40af1 (patch) | |
tree | 0fcb58f2e299ac0962b121e1d44f73eda87b6066 | |
parent | 732207b00176856dd8101a27e8d31a90926fa4da (diff) |
Allow empty `<>` link destination in reference link.
-rw-r--r-- | src/inlines.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/inlines.c b/src/inlines.c index 6f93fd4..458ab72 100644 --- 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; |