adam-p / markdown-here

Google Chrome, Firefox, and Thunderbird extension that lets you write email in Markdown and render it before sending.
http://markdown-here.com
MIT License
59.62k stars 11.26k forks source link

Support for Emoji Emoticons #101

Open cyrusdavid opened 11 years ago

cyrusdavid commented 11 years ago

It would be nice to have support for Emoji emoticons instead of boring smileys. The images could be hosted on imgur.

adam-p commented 11 years ago

Emoji support isn't necessarily dependent on support first being added to Marked.js (the rendering library Markdown Here uses), but it'd sure help. There's already movement toward getting it added: https://github.com/chjj/marked/search?q=emoji&source=cc&type=Issues

pradyunsg commented 9 years ago

chjj/marked#288 seems pretty complete. And it seems that something like this will end up as a part of marked anyway.

Just one problem: Where would the emoji files be hosted...

adam-p commented 9 years ago

There's the possibility of using natively rendered emoji. So no external images. I briefly tried it out and the results were spotty. I'll include some screenshots.

Here are the values I used (the happy face shows up fine when I'm writing this, but not in the preview): 😁 😁 ..and in a code block:

😁 😁

Chrome+Gmail subject list: emoji-chrome gmail

Chrome+Gmail message view: emoji-chrome gmail-2

Chrome+Inbox subject list: emoji-chrome inbox

Chrome+Inbox message view: emoji-chrome inbox-2

Firefox+Gmail: emoji-firefox gmail

Thunderbird: emoji-thunderbird

pradyunsg commented 9 years ago

Yay!!! Sounds and looks good.

pradyunsg commented 9 years ago

After the burst of excitement...

Inbox does not seem to be co-operative... :disappointed:

Also, any thoughts about consistency? How about using externally hosted Emoji One? The images are hosted on cdnjs so they could be used... Something like that should fix inconsistency and will work anywhere where it's allowed to use images.

(I wrote this while half-asleep, will edit/improve)

Redsandro commented 8 years ago

@adam-p I just noticed this possible duplicate for this issue at https://github.com/adam-p/markdown-here/issues/348. Although I'm specifically pro smileys used in github, because they are the ones that go hand in hand with most markdown related apps: Github, Trello, Gitter, etc.

@Redsandro wrote:

Could we add support for all the github smileys?
http://www.emoji-cheat-sheet.com/

Not sure how the markdown is parsed internally, but here's a plugin for mark-it-down:
https://github.com/markdown-it/markdown-it-emoji

@pradyunsg Emoji One is terrible imo. :cry:

Redsandro commented 8 years ago

@adam-p Haven't verified it's state, but there seems to be a related pr merged in Marked.js: https://github.com/lookback/marked/commit/c1108a082a1de0c2850bea96f608801cc157274a

emoji

Type: Boolean / String / Function Default: false

Enable replacement of colon-delimited Emoji emoticon codes like :warning: or :+1:. This option requires the gfm option to be true. :octocat:

  • String: parsed as template for the replacement value, accepts the {emoji} variable.
  • true: use the default <img> with a local URL prefix.
  • Function: called with each emoji code, must return a replacement string like an <img> or <span> tag. Don't forget to use escape(emoji) or encodeURIComponent(emoji) where needed.
marked.setOptions({
  emoji: function (emoji) {
    return '<span data-emoji="' + emoji + '"></span>';
  }
});

The default template:

<img src="/graphics/emojis/warning.png" alt=":warning:" title=":warning:" 
  class="emoji" align="absmiddle" height="20" width="20">`

:warning: The images for the emoji set used by GitHub can be found in the repos of the emoji-cheat-sheet. :point_left::+1:

pradyunsg commented 8 years ago

@Redsandro The licensing of the icons in https://github.com/arvida/emoji-cheat-sheet.com might be an issue.


And, because this is something about legality...

DISCLAIMER: I'm no legal expert. I know nothing about anything and don't take my word for anything. Don't blame me if anything bad happens.


PS: Just being safe. :wink:

Redsandro commented 8 years ago

@pradyunsg

I'm not a lawyer either, but I don't see a problem.

Upstream license:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Source: https://github.com/github/gemoji/blob/master/LICENSE

They can apparently be used "without restriction" for anything less than "substantial portions". So allow a max of 10 different smileys per message. :yum:

pradyunsg commented 8 years ago

https://github.com/github/gemoji - MIT License!

But that repo is for handling the emoji related metadata (names for glyphs and the likes) not the actual images/glyphs. So, it's completely unrelated to the actual glyphs... And you read the license wrong.

FWIW, the emoji's used here at Github are Apple designed Emojis. And I found https://github.com/iamcal/php-emoji/raw/master/lib/emoji.png but again I'm not sure how legal it would be use it...

Emoji One is a free-to-use emoji icon-set. No legal issues should occur from the use of those glyphs.

(editted)

And, because this is something about legality...

DISCLAIMER: I'm no legal expert. I know nothing about anything and don't take my word for anything. Don't blame me if anything bad happens.

Redsandro commented 8 years ago

That repo seems to redistribute the emoji under quoted license. And Github (and Trello) probably had some lawyers look over this.

And you read the license wrong.

I applaud your enthusiasm over this issue. For future reference though, there is nothing constructive about claiming something is wrong without substantiating that claim. Next time please consider either elaborating or refraining.