diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-09-15 12:38:51 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-09-15 12:38:51 +0200 |
commit | 53ef343a65e3da19d605cfb7e8909004cfac954e (patch) | |
tree | 94864096ac54f1fd83781d46e665aaa2084c2630 /src/inlines.c | |
parent | 733c2ea2818f5a369b74a594447361ed3eec1f21 (diff) |
Allow a shortcut link before a (.
See jgm/CommonMark#427
Diffstat (limited to 'src/inlines.c')
-rw-r--r-- | src/inlines.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/inlines.c b/src/inlines.c index e5ca8e2..586279f 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -799,7 +799,7 @@ noMatch: // Return a link, an image, or a literal close bracket. static cmark_node *handle_close_bracket(subject *subj) { - bufsize_t initial_pos; + bufsize_t initial_pos, after_link_text_pos; bufsize_t starturl, endurl, starttitle, endtitle, endall; bufsize_t n; bufsize_t sps; @@ -833,6 +833,8 @@ static cmark_node *handle_close_bracket(subject *subj) { // Now we check to see if it's a link/image. is_image = opener->image; + after_link_text_pos = subj->pos; + // First, look for an inline link. if (peek_char(subj) == '(' && ((sps = scan_spacechars(&subj->input, subj->pos + 1)) > -1) && @@ -863,7 +865,8 @@ static cmark_node *handle_close_bracket(subject *subj) { goto match; } else { - goto noMatch; + // it could still be a shortcut reference link + subj->pos = after_link_text_pos; } } |