diff --git a/src/Components/Inlines/Link.php b/src/Components/Inlines/Link.php index e6a4c99..41780c6 100644 --- a/src/Components/Inlines/Link.php +++ b/src/Components/Inlines/Link.php @@ -79,6 +79,8 @@ final class Link implements Inline $definition = \strtolower($label); } + $definition = \preg_replace('/\s++/', ' ', \trim($definition)); + $data = $State->get(DefinitionBook::class)->lookup($definition); if (! isset($data)) { diff --git a/tests/data/text_reference.html b/tests/data/text_reference.html index 11e4d37..3d7b854 100644 --- a/tests/data/text_reference.html +++ b/tests/data/text_reference.html @@ -5,4 +5,8 @@ one defined on 2 lines

one with a mixed case label and an upper case definition

one with the a label on the next line

-

link

\ No newline at end of file +

link

+

This one has a line +break.

+

This one has a line +break with a line-ending space.

\ No newline at end of file diff --git a/tests/data/text_reference.md b/tests/data/text_reference.md index 1a66a5c..74b8dae 100644 --- a/tests/data/text_reference.md +++ b/tests/data/text_reference.md @@ -18,4 +18,12 @@ one][website] defined on 2 lines [one] [1] with the a label on the next line -[`link`][website] \ No newline at end of file +[`link`][website] + +This one has a [line +break]. + +This one has a [line +break] with a line-ending space. + +[line break]: /foo \ No newline at end of file