diff --git a/Parsedown.php b/Parsedown.php index 8eb4bfe..701a204 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -528,7 +528,7 @@ class Parsedown # Reference(d) Link / Image - if ($this->reference_map and strpos($text, '[') !== FALSE and preg_match_all('/(!?)\[(.+?)\](?:[ ]?\[(.*?)\])?/ms', $text, $matches, PREG_SET_ORDER)) + if ($this->reference_map and strpos($text, '[') !== FALSE and preg_match_all('/(!?)\[(.+?)\](?:\n?[ ]?\[(.*?)\])?/ms', $text, $matches, PREG_SET_ORDER)) { foreach ($matches as $matches) { diff --git a/tests/data/reference_link.html b/tests/data/reference_link.html index 90a907b..2f5a938 100644 --- a/tests/data/reference_link.html +++ b/tests/data/reference_link.html @@ -4,6 +4,7 @@
Here's one on 2 lines.
Here's one with a different URL.
Here's one with a semantic name.
+Here's one with definition name on the next line.
Here's [one][404] with no definition.
Here's an image:
Here's an implicit one.
diff --git a/tests/data/reference_link.md b/tests/data/reference_link.md index 9b2c620..1ad5bd0 100644 --- a/tests/data/reference_link.md +++ b/tests/data/reference_link.md @@ -22,6 +22,9 @@ Here's [one][website] with a semantic name. [website]: http://parsedown.org +Here's [one] +[website] with definition name on the next line. + Here's [one][404] with no definition. Here's an image: ![Markdown Logo][image]