Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Parse Links, Emails, Phone Numbers #204

Closed
rayliverified opened this issue Jan 2, 2020 · 4 comments
Closed

FEATURE: Parse Links, Emails, Phone Numbers #204

rayliverified opened this issue Jan 2, 2020 · 4 comments

Comments

@rayliverified
Copy link
Contributor

rayliverified commented Jan 2, 2020

Hi Mr. Mathew Whitaker,
How do you think raw links, emails, and phone numbers should be handled? @Sub6Resources

Should link parsing be done by the end user or should it be included as part of this library? Currently, the way to make links clickable using the HTML widget is to pre-parse the text and pass a prepared String with all tags appended to the widget.

There are pros and cons to both approaches. The drawback of adding link parsing to this library is increasing the scope of this library and not parsing links the way developers want. The benefit is saving people from writing their own Regex parsers which is hard and error prone.

I would like to add an option to the HTML widget to parse links such as autolink: true to parse raw link and emails.

@Sub6Resources
Copy link
Owner

@searchy2, I do believe this would fall outside the scope of this library, which is simply to display HTML that the widget is given. Any parsing like that should be done beforehand. Creating another package for it wouldn't be a bad idea since it's probably a fairly common problem.

@rayliverified
Copy link
Contributor Author

Outside of the package it is then! I'll probably try my hand at creating a link parser.

Do you have any suggestions for link parsing? I'm modifying the linkify library right now because it confuses emails and websites sometimes (emails end with website domains). Any advice?

@Sub6Resources
Copy link
Owner

Phone numbers shouldn't be too hard. For differentiating between emails and websites, an email will always have the @ symbol, while a website URL will not (at least that I've ever seen)

@Sub6Resources
Copy link
Owner

Simply wrapping all of the links in an <a href> </a>, copying the URL into the href and then adding mailto: or tel: for emails and phone numbers should be enough.

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

No branches or pull requests

2 participants