Open mbroshi opened 4 years ago
Please explain use case. Because looks like broken content. Linkifier is expected to be used with valid human-readable texts.
This came up in https://github.com/HabitRPG/habitica/issues/12437
Someone has a sentence with an email address--name@example.com--and expects the address to have a link.
Also, every other punctuation I've added as a suffix after the link still tests as true. It's just hyphens that make the text test as false.
Looks like GitHub's link parser also has amusing behavior when hyphens are involved :laughing:
Similar poblem exists for links. I see how heading for emails can be improved, but not sure about tail.
It's curious that it's just hyphens. To be honest, I have trouble parsing the regexes, so I can't be of much help. The simplest I idea I have is to strip trailing hyphens (which are not part of TLD/SLDs), if that's a feasible solution.
When there is a valid email address, such as name@example.com, if it is followed by a hyphen, linkify.test returns false:
I would expect both to be true.
You can test this by adding these two lines to
test/fixtures/lines.txt
: