Skip to content

Commit

Permalink
Allow shortcut link before an open paren (see commonmark/commonmark-s…
Browse files Browse the repository at this point in the history
  • Loading branch information
colinodell committed Nov 22, 2016
1 parent 30e7cf8 commit f391b62
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Inline/Parser/CloseBracketParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,18 @@ public function setEnvironment(Environment $environment)
protected function tryParseLink(Cursor $cursor, ReferenceMap $referenceMap, Delimiter $opener, $startPos)
{
// Check to see if we have a link/image
$previousState = $cursor->saveState();

// Inline link?
if ($cursor->getCharacter() === '(') {
if ($result = $this->tryParseInlineLinkAndTitle($cursor)) {
return $result;
} else {
$cursor->restoreState($previousState);
}
} elseif ($link = $this->tryParseReference($cursor, $referenceMap, $opener, $startPos)) {
}

if ($link = $this->tryParseReference($cursor, $referenceMap, $opener, $startPos)) {
return ['url' => $link->getDestination(), 'title' => $link->getTitle()];
}

Expand Down

0 comments on commit f391b62

Please sign in to comment.