Skip to content

Commit

Permalink
Allow a shortcut link before a (.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgm committed Sep 15, 2016
1 parent 9c0d399 commit d04b1e8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/inlines.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ static int link_label(subject *subj, cmark_chunk *raw_label) {

// 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;
Expand Down Expand Up @@ -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) &&
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit d04b1e8

Please sign in to comment.