gregjacobs / Autolinker.js

Utility to Automatically Link URLs, Email Addresses, Phone Numbers, Twitter handles, and Hashtags in a given block of text/HTML
MIT License
1.48k stars 238 forks source link

Support scheme url starting with emoji #408

Open caiofct opened 5 months ago

caiofct commented 5 months ago

This PR is a fix for https://github.com/gregjacobs/Autolinker.js/issues/399. It essentially allows a schema url to start with any char including an emoji.

caiofct commented 5 months ago

@gregjacobs This is the new PR. Sorry about the trouble.

caiofct commented 5 months ago

@gregjacobs Any chance you could take a look at this one soon? Really appreciate if we could merge this and get a new version out so we could use the new version in our apps. Let me know if you need anything from me.

gregjacobs commented 5 months ago

Hey @caiofct. Sorry for the delay.

Unfortunately I don't think this is the correct fix (although it works at the moment, unexpectedly 😄 ). I'm looking more into it now though.

We don't want to conceptually allow emojis to be valid scheme characters because a scheme (like http or https) would always be only ascii letters or numbers. I think instead, when we encounter an emoji, we want to skip over it and put the state machine back into the "no match" state. I'll play with it a bit.

Best, Greg

caiofct commented 4 months ago

Hey @gregjacobs any luck on this issue?

Hey @caiofct. Sorry for the delay.

Unfortunately I don't think this is the correct fix (although it works at the moment, unexpectedly 😄 ). I'm looking more into it now though.

We don't want to conceptually allow emojis to be valid scheme characters because a scheme (like http or https) would always be only ascii letters or numbers. I think instead, when we encounter an emoji, we want to skip over it and put the state machine back into the "no match" state. I'll play with it a bit.

Best, Greg