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

Emoji syntax gravatars #56

Closed
cameronmcefee opened this issue Jun 13, 2013 · 14 comments
Closed

Emoji syntax gravatars #56

cameronmcefee opened this issue Jun 13, 2013 · 14 comments

Comments

@cameronmcefee
Copy link

I'm not sure if this is a good idea or if this is actually the place to suggest it, but it'd be cool if you could put something like :cameronmcefee: in any gfm field and have the person's avatar appear, probably linked to their profile and maybe tool-tipped with their name.

@rtomayko
Copy link
Contributor

Kind of love it personally. 👍 Some will conflict with real emoji so I wonder if it'd be better to use a different syntax. :@cameronmcefee: or something?

@jbarnette
Copy link
Contributor

Pretty cool secret feature. :)

On Fri, Jun 14, 2013 at 5:12 PM, Ryan Tomayko notifications@github.comwrote:

Kind of love it personally. [image: 👍] Some will conflict with real
emoji so I wonder if it'd be better to use a different syntax. :
@cameronmcefee https://github.com/cameronmcefee: or something?


Reply to this email directly or view it on GitHubhttps://github.com//issues/56#issuecomment-19487983
.

@cameronmcefee
Copy link
Author

:@cameronmcefee: or something?

I wonder if that would play nicely with current @mentions

@jch
Copy link
Contributor

jch commented Jul 2, 2013

I'd pick some unused syntax like jch

@cameronmcefee
Copy link
Author

since it's going to be an image and a link, what if we just used an already expected syntax?

![Cameron McEfee](@cameronmcefee)

@skalnik
Copy link

skalnik commented Jul 3, 2013

But that doesn't usually form a link does it? I thought it was just embed the image.

@cameronmcefee
Copy link
Author

They come in as a link to the source. Since we'd be modifying the behavior a bit to link it to a profile that may not be ideal

@simeonwillbanks
Copy link
Contributor

Hello All,

May I help by implementing this filter?

As I see it, the filter is responsible for parsing the document, locating ~cameronmcefee~ (or similar) strings, and replacing those with an avatar linked to a profile (using context base_url). It's very similar to the current MentionFilter.

Also, the filter can depend upon a service, and the service is responsible for converting a profile string into an avatar. This way, an application can implement cameronmcefee to cameronmcefee in any manner.

I hacked up a prototype to review.

Thanks for considering my idea, and any input is appreciated!

@yury
Copy link

yury commented Nov 2, 2013

I'd like :@cameronmcefee:

@jch
Copy link
Contributor

jch commented Jan 4, 2014

@simeonwillbanks happy new years! Just revisiting old issues lying around. Are you still interested in turning your prototype into a pull request?

As far as feedback, I'm not a fan of the indirection of passing in a service. Yes, it is more flexible, but at this level, the code does nothing and leaves all the work to be done by the service. I'd rather just have common gravatar features passed in.

@jch
Copy link
Contributor

jch commented Jan 4, 2014

Also, ~ may not be a good delimiter because ~~ are already used for strikethroughs by github-markdown. edit: maybe the delimiter can be a passed in option that has a sane default.

@simeonwillbanks
Copy link
Contributor

@jch happy new years to you! Yes. 😄

I suggested a service for two reasons:

  1. Flexibility (Gravatar, home grown solution, etc)
  2. Likelihood of login to avatar being non-deterministic

With Gravatar, login to avatar isn't deterministic. 😦 Gravatar requires an email hash for the avatar URL.

However, you make a solid point. Let's review a Gravatar URL, and see what a Filter could build. I grabbed mine from this comment.

https://0.gravatar.com/avatar/a624cb08e20db3ac4adb6380928a7b11?d=https%3A%2F%2Fidenticons.github.com%2Fde0265f943d367c375979d1fed48bf65.png&r=x&s=140

It can be simplified. Notably, we can replace my GitHub user ID hash with my login.

https://www.gravatar.com/avatar/a624cb08e20db3ac4adb6380928a7b11?d=https%3A%2F%2Fidenticons.github.com%2Fsimeonwillbanks.png&r=x&s=140

The new Filter could receive Gravatar params and have sensible defaults like &r=x&s=25.

The Default Image is a bit trickier. Maybe the Filter defines a constant which aids a search and replace?

login = "simeonwillbanks"
class Filter
  TOKEN = "__login_token__"
end
# default_image_url sent to Filter and references Filter::TOKEN
default_image_url = "https://identicons.github.com/#{Filter::TOKEN}.png"
default_image_url.sub Filter::TOKEN, login
#=> "https://identicons.github.com/simeonwillbanks.png"

The email hash requires a simpler service than the prototype service.

# Filter receives service
# Service defines login_to_email
email = service.login_to_email "simeonwillbanks"
# => "sfw@simeonfosterwillbanks.com"
email_hash = Digest::MD5.hexdigest email
#=> "a624cb08e20db3ac4adb6380928a7b11"
basic_gravatar_url = "https://www.gravatar.com/avatar/#{email_hash}"
#=> "https://www.gravatar.com/avatar/a624cb08e20db3ac4adb6380928a7b11"

Thoughts?

Also, 👍 for passed in delimiter with sane default.

Thanks!

@jch
Copy link
Contributor

jch commented Jan 7, 2014

Flexibility (Gravatar, home grown solution, etc)

That's a good point. If that's the case, I'd suggest naming your filter something more descriptive. Maybe just AvatarFilter for the generic interface that takes a service, and GravatarService or GravatarFilter for the concrete implementation.

I like that this filter doesn't add any external code dependencies. Normally, I wouldn't want to depend on a 3rd party external service either, but Gravatar's been around for a long time and feels like the common choice.

@simeonwillbanks
Copy link
Contributor

@jch Thanks!

An interface with a concrete implementation is a good idea.

Agreed. I'll start a branch, and commit early and often. We can hammer out the specifics.

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 a pull request may close this issue.

7 participants