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

Make Links Clickable #380

Merged
merged 1 commit into from
Oct 24, 2014
Merged

Make Links Clickable #380

merged 1 commit into from
Oct 24, 2014

Conversation

malakada
Copy link

Closes #328.


function linkify(text) {
if (text) {
text = text.replace(/(^|[^\/])(www\.[^\.]+\.[\S]+(\b|$))/gi, '$1http://$2');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think false positives are very annoying. I'd rather have zero false positives and not support, e.g. 'www.example.com'. So I think we should require the protocol in order to make links blue. This makes the detection regex much simpler, and lets us do it with only 1 regex.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you're saying you only want to link a fully-formed domain of something like 'http://wowihadtotypehttp.com'?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh. It would seem that that's what Github does.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub has a clue :)

andrewrk added a commit that referenced this pull request Oct 24, 2014
@andrewrk andrewrk merged commit 0d4f715 into master Oct 24, 2014
@andrewrk andrewrk deleted the feature/linkify_urls branch October 24, 2014 15:48
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.

chat: urls should turn into anchor tags with target=_blank
2 participants