Skip to content

Trim spaces off start and end of link reference#794

Merged
Martin1887 merged 2 commits intopulldown-cmark:masterfrom
notriddle:notriddle/trim-link-label
Jan 14, 2024
Merged

Trim spaces off start and end of link reference#794
Martin1887 merged 2 commits intopulldown-cmark:masterfrom
notriddle:notriddle/trim-link-label

Conversation

@notriddle
Copy link
Collaborator

@notriddle notriddle commented Nov 30, 2023

Fixes #793

This is specifically called out by the spec:

One label matches another just in case their normalized forms are equal. To normalize a label, strip off the opening and closing brackets, perform the Unicode case fold, strip leading and trailing spaces, tabs, and line endings, and collapse consecutive internal spaces, tabs, and line endings to a single space. If there are multiple matching reference link definitions, the one that comes first in the document is used. (It is desirable in such cases to emit a warning.)

This is specifically called out by [the spec]:

> One label matches another just in case their normalized forms are equal.
> To normalize a label, strip off the opening and closing brackets, perform
> the Unicode case fold, **strip leading and trailing spaces, tabs, and line
> endings**, and collapse consecutive internal spaces, tabs, and line endings
> to a single space. If there are multiple matching reference link
> definitions, the one that comes first in the document is used. (It is
> desirable in such cases to emit a warning.)

[the spec]: https://spec.commonmark.org/0.30/#matches
@notriddle notriddle force-pushed the notriddle/trim-link-label branch from e4664ad to b8e98bd Compare January 14, 2024 17:20
@Martin1887 Martin1887 merged commit f73dc5d into pulldown-cmark:master Jan 14, 2024
@notriddle notriddle deleted the notriddle/trim-link-label branch January 14, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fuzz test] link labels should be trimmed

2 participants