Skip to content

Add support for usernames across more social networks #119

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

Open
jmillerdesign opened this issue Sep 4, 2015 · 11 comments
Open

Add support for usernames across more social networks #119

jmillerdesign opened this issue Sep 4, 2015 · 11 comments

Comments

@jmillerdesign
Copy link

Could this either be added to the core, or could you explain how I could pass options to Autolinker.js to allow for this? It's limiting usernames to 15 characters, but other networks support longer usernames.

Twitter: 15
Instagram: 30
Facebook: 50
Tumblr: 32

@gregjacobs
Copy link
Owner

Hey, sorry for the late response here.

Currently Autolinker only has built-in support for Twitter and there's really no way to override it, but I like the idea of a username option and specifying which service it should link to. Will work on this.

@simison
Copy link
Contributor

simison commented Nov 8, 2015

I feel like Twitter username should be something generic rather than tight to one service. It could default to twitter, but user should be able to defined the URL and syntax easily.

For this it would make sense to rename twitter thing to something else, so it would be a breaking change.

My usercase would be to use it with my own site's usernames, actually.

@gregjacobs
Copy link
Owner

Definitely agree, and interesting point too for your own website. I think we can maintain backward compatibility though for the options, where the newer username option would just override the twitter option if both are provided.

Any ideas on how you might like the options laid out for this? My initial thought is something like this:

Autolinker.link( text, {
    username : 'twitter'  // or 'facebook', 'instagram', 'tumblr', etc.
} );

And then for the use case of your own website, you can always use the replaceFn, but feeling like it should be a bit easier if possible. Maybe something like this:

Autolinker.link( text, {
    username : { 
        type: 'custom', 
        template: 'http://my.website.com/{username}' 
    }
} );

Thoughts?

@simison
Copy link
Contributor

simison commented Nov 9, 2015

Yeah and I feel like passing regexp as an option should be possible as well, since someone might want to support _-. and capital letters and some just lowercase a-z.

Oh and sometimes you might want to recognise capital letters but have them lowercase at the URL.

@devonzara
Copy link

Personally, I'd prefer the term 'mention' rather than 'username', but that would break backwards compatibility unless made as an alias. Secondly, I'd probably use service rather than type.

I agree that there should be an optional regex option and a way to set the prefixing character/regex, seeing as services such as Google+ use a + instead of an @ symbol.

eg.

Autolinker.link( text, {
    mention: { 
        service: 'custom', // twitter (default), facebook, instagram, tumblr, google
        regex: '[A-Z][a-zA-Z0-9]{2, 13}',
        prefix: '+',
        template: 'http://my.website.com/{username}' // 
    }
} );

@simison
Copy link
Contributor

simison commented Nov 10, 2015

+1 @devonzara; good thinking!

@ReedD
Copy link

ReedD commented Dec 1, 2015

👍 Any word on this?

@antondomratchev
Copy link

Resurecting in 3...2...1
@devonzara Do you have any work done for your suggestion, I would like to get an implementation of this into a PR but wanted to double check if you had any work in progress.

@jmillerdesign
Copy link
Author

I'd be willing to help out on a PR if we can agree on a syntax.

@gregjacobs
Copy link
Owner

blockquote, div.yahoo_quoted { margin-left: 0 !important; border-left:1px #715FFA solid !important; padding-left:1ex !important; background-color:white !important; } Hey, yes, so sorry, I'm so crazy busy these days. What are your thoughts on that?

Sent from Yahoo Mail for iPhone

On Monday, June 13, 2016, 12:30 PM, J. Miller [email protected] wrote:

I'd be willing to help out on a PR if we can agree on a syntax.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@olafleur
Copy link
Collaborator

olafleur commented Mar 3, 2017

@jmillerdesign : as of today, we have, mentions for Twitter and Instagram.

With the current structure, I guess it would be relatively easy to add Facebook and Tumblr if this is still wanted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants