summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/inlines.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/inlines.c b/src/inlines.c
index 232fc10..352ded3 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -755,6 +755,7 @@ static int link_label(subject* subj, cmark_chunk *raw_label)
if (c == ']') { // match found
*raw_label = cmark_chunk_dup(&subj->input, startpos + 1, subj->pos - (startpos + 1));
+ cmark_chunk_trim(raw_label);
advance(subj); // advance past ]
return 1;
}
@@ -1111,7 +1112,7 @@ int cmark_parse_reference_inline(cmark_strbuf *input, cmark_reference_map *refma
subject_from_buf(&subj, input, NULL);
// parse label:
- if (!link_label(&subj, &lab))
+ if (!link_label(&subj, &lab) || lab.len == 0)
return 0;
// colon: