Skip to content

Commit b89d3d9

Browse files
Fixes issue parsing Markdown images
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
1 parent fad6d8f commit b89d3d9

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Sources/Parsers/MarkdownParser.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class MarkdownParser extends Parser
191191
// or
192192
'|' .
193193
// Non-space, non-control characters.
194-
'[^\s\p{Cc}]+' .
194+
'[^\s\p{Cc}]+?' .
195195
')' .
196196
')';
197197

@@ -2697,10 +2697,8 @@ protected function parseLink(array $chars, int &$i, array &$content): void
26972697

26982698
$str = implode('', array_slice($chars, $delim['properties']['position'], $i - $delim['properties']['position'])) . ']' . mb_substr(implode('', $chars), $i + 1);
26992699

2700-
$prefix = $delim['type'] === '![' ? '!' : '';
2701-
27022700
// Inline link/image?
2703-
if (preg_match('~^' . $prefix . self::REGEX_LINK_INLINE . '~u', $str, $matches)) {
2701+
if (preg_match('~^' . self::REGEX_LINK_INLINE . '~u', $str, $matches)) {
27042702
$this->parseEmphasis($content, $c);
27052703

27062704
$text = array_slice($content, $c + 1);
@@ -2730,7 +2728,7 @@ protected function parseLink(array $chars, int &$i, array &$content): void
27302728
self::REGEX_LINK_REF_COLLAPSED,
27312729
self::REGEX_LINK_REF_SHORTCUT,
27322730
] as $regex) {
2733-
if (preg_match('~' . $prefix . $regex . '~u', $str, $matches)) {
2731+
if (preg_match('~' . $regex . '~u', $str, $matches)) {
27342732
break;
27352733
}
27362734
}

0 commit comments

Comments
 (0)