A Meteor package to convert emoji codes (like the ones used by GitHub and Slack) into twitter-style emoji images. This is a fork of meteor-emoji that keeps the same API but has graphics from Twitter.
Using the Meteor Package System, add the emoji package from Atmosphere:
npm install git+ssh://[email protected]:mastastealth/meteor-twemoji.git --save
In your app, use Emoji.convert(text)
to emojify strings. All substrings of the general form :emoji_name:
will be replaced with <img>
tags that should just work. The converter isn't smart about emoji that don't actually exist.
If you wish to insert an emoji inside your HTML you can use the emoji
helper followed by the name of the emoji you wish to display:
{{> emoji ":alien:"}}
Alternatively, you can emojify a whole block:
{{#emoji}}:smile:, not :cry:{{/emoji}}
You can also use this in combination with the showdown
Meteor package:
{{#markdown}}{{#emoji}}your_raw_markdown_text{{/emoji}}{{/markdown}}
The generated <img>
tags are conveniently adorned with the emoji
class, so you can set emoji-specific styling through that. Juts as instructed in Twemoji, if you'd like to size the emoji according to the surrounding text, you can use the following CSS:
img.emoji {
height: 1em;
width: 1em;
margin: 0 .05em 0 .1em;
vertical-align: -0.1em;
}
This code comes from a Meteor package created by @AlarmingCow, now maintained by @SeriousM. All graphics were created by Twitter and are licensed under CC-BY 4.0.