parshap / html-linkify

Turn plain text links into safe HTML anchor elements
11 stars 5 forks source link

Unable to linkify when link has email as parameter #8

Open binarykitchen opened 9 years ago

binarykitchen commented 9 years ago
https://videomail.io/?to=daniel@hello.co.nz&subject=Question blahblah 

ends up in a weird, broken link where the email address becomes another mailto link, but shouldn't.

parshap commented 9 years ago

This is the result of how the regular expression being used to find links (originally from here) treats the @ symbol. You may be able to fix this by changing the regex.

There is also another regex-based implementation used in twitter-text. It's probably a better regex than the one currently used – maybe we can use it.

binarykitchen commented 9 years ago

@parshap I see. So, isn't this a bug within that regular expression https://github.com/parshap/html-linkify/blob/02bc652011592b43569d79e0dc92658a448783ec/index.js#L7 ?

Do you think you can fix that or have no time and prefer me to do a PR and fix that regex?

parshap commented 9 years ago

Yes, it is indeed a bug within that regular expression. I don't currently have the time to try and fix it, but would happily look at a PR.

binarykitchen commented 9 years ago

Alright, I ll think about it when I have time ...

binarykitchen commented 9 years ago

I am sorry, this is too hard and already tried one hour to fix that rEmail regex :(

parshap commented 9 years ago

Yes the regex is painful. I think the right approach is using a real lexer and parser.

binarykitchen commented 9 years ago

I'm afraid, I'll have to give this one a pass. Too hard for me right now. Hope someone else can do this one day?