# Twitter Emoji (Twemoji) [![Build Status](https://travis-ci.org/twitter/twemoji.svg?branch=gh-pages)](https://travis-ci.org/twitter/twemoji) A simple library that provides standard Unicode [emoji](http://en.wikipedia.org/wiki/Emoji) support across all platforms. **Twemoji v2.2** adheres to the [Unicode 9.0 spec](http://unicode.org/versions/Unicode9.0.0/) and supports the [Emoji 4.0 draft spec](http://www.unicode.org/reports/tr51/tr51-8.html) (codepoints and supported emoji are subject to change until the Emoji 4.0 spec is ratified). The Twemoji library offers support for **2,477** emojis, including skin tone and gender modifiers. ## CDN Support The folks over at [MaxCDN](https://www.maxcdn.com) have graciously provided CDN support. Use the following in the `` tag of your HTML document(s): ```html ``` ## Breaking changes in V2 _TL;DR_: there's no `variant` anymore, all callbacks receive the transformed `iconId` and in some cases the rawText too. There are a few potentially breaking changes in `twemoji` version 2: * the `parse` invoked function signature is now `(iconId, options)` instead of `(icon, options, variant)` * the `attributes` function now receives `(rawText, iconId)` instead of `(icon, variant)` * the **default** remote protocol is now **https** regardless of whether the current site is _http_ or even _file_ * the **default** PNG icon size is **72** pixels and **there are no other PNG assets** for 16 or 32. * in order to access latest assets you need to specify *folder* `2/72x72` or `2/svg`. Everything else is pretty much the same, so if you were using the defaults, all you need to do is to add the version `2/` before the `twemoji.js` file you were using. ## API Following are all the methods exposed in the `twemoji` namespace. ### twemoji.parse( ... ) V1 This is the main parsing utility and has 3 overloads per parsing type. There are mainly two kinds of parsing: [string parsing](https://github.com/twitter/twemoji#string-parsing) and [DOM parsing](https://github.com/twitter/twemoji#dom-parsing). Each of them accepts a callback to generate an image source or an options object with parsing info. Here is a walkthrough of all parsing possibilities: ##### string parsing (V1) Given a generic string, replaces all emoji with an `` tag. While this can be used to inject emoji via image tags in `innerHTML`, please note that this method does not sanitize the string or prevent malicious code from being executed. As an example, if the text contains a `