mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Normalise link reference lookups
Ref: https://github.com/erusev/parsedown/pull/104
This commit is contained in:
parent
7f6127f3f8
commit
33522f0aa4
@ -79,6 +79,8 @@ final class Link implements Inline
|
|||||||
$definition = \strtolower($label);
|
$definition = \strtolower($label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$definition = \preg_replace('/\s++/', ' ', \trim($definition));
|
||||||
|
|
||||||
$data = $State->get(DefinitionBook::class)->lookup($definition);
|
$data = $State->get(DefinitionBook::class)->lookup($definition);
|
||||||
|
|
||||||
if (! isset($data)) {
|
if (! isset($data)) {
|
||||||
|
@ -6,3 +6,7 @@ one</a> defined on 2 lines</p>
|
|||||||
<p><a href="http://example.com">one</a> with a mixed case label and an upper case definition</p>
|
<p><a href="http://example.com">one</a> with a mixed case label and an upper case definition</p>
|
||||||
<p><a href="http://example.com">one</a> with the a label on the next line</p>
|
<p><a href="http://example.com">one</a> with the a label on the next line</p>
|
||||||
<p><a href="http://example.com"><code>link</code></a></p>
|
<p><a href="http://example.com"><code>link</code></a></p>
|
||||||
|
<p>This one has a <a href="/foo">line
|
||||||
|
break</a>.</p>
|
||||||
|
<p>This one has a <a href="/foo">line
|
||||||
|
break</a> with a line-ending space.</p>
|
@ -19,3 +19,11 @@ one][website] defined on 2 lines
|
|||||||
[1] with the a label on the next line
|
[1] with the a label on the next line
|
||||||
|
|
||||||
[`link`][website]
|
[`link`][website]
|
||||||
|
|
||||||
|
This one has a [line
|
||||||
|
break].
|
||||||
|
|
||||||
|
This one has a [line
|
||||||
|
break] with a line-ending space.
|
||||||
|
|
||||||
|
[line break]: /foo
|
Loading…
Reference in New Issue
Block a user