From 49fa4191684d840c5900c6706d37cb659fed4edb Mon Sep 17 00:00:00 2001 From: Andrea Giammarchi Date: Tue, 1 Mar 2016 18:25:41 +0000 Subject: [PATCH] updating info to V2 and Unicode 8 --- README.md | 42 +++++++++++++++++++++++++++++++++--------- index.html | 8 ++++---- package.json | 6 +++--- 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 41a71363..c8c28626 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,35 @@ A simple library that provides standard Unicode [emoji](http://en.wikipedia.org/wiki/Emoji) support across all platforms. -## CDN Support +## Unicode 8.0 and Diversity +The **twemoji V2** adheres to the [8.0 Unicode version](http://unicode.org/versions/Unicode8.0.0/) and **supports** 1661 different emoji, including **[diversity](http://www.unicode.org/reports/tr51/#Diversity)**. +The previous twemoji V1 adheres to the [7.0 Unicode version](http://www.unicode.org/charts/PDF/Unicode-7.0/U70-1F300.pdf) and supports 872 different emoji. + +## Version 2 CDN Support + +The folks over at [MaxCDN](https://www.maxcdn.com) graciously provide CDN support for both version 1 and version 2. + +For the latter one, 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 receives the transformed `iconId` and in some case the rawText too. + +There are 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 will receives `(rawText, iconId)` instead of `(icon, variant)` + * the **default** remote protocol is now **https** regardless 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 Unicode 8 ready assets you need to specify *folder* `2/72x72` or `2/svg`. + +Everything else is pretty much the same so if you were using defaults, all you need to do is to add the version `2/` before the `twmoji.js` file you were using. + + +## Version 1 CDN Support The folks over at [MaxCDN](https://www.maxcdn.com) graciously provide CDN support. @@ -22,7 +50,7 @@ Alternatively you can use [cdnjs](https://cdnjs.com/) if you prefer: Following all methods exposed through the `twemoji` namespace. -### twemoji.parse( ... ) +### twemoji.parse( ... ) V1 This is the main parsing utility and has 3 overloads per each parsing type. @@ -32,7 +60,7 @@ Each of them accept a callback to generate each image source or an options objec Here is a walk through all parsing possibilities: -##### string parsing +##### string parsing (V1) Given a generic string, it will replace all emoji with an `` tag. While this can be used to inject via `innerHTML` emoji image tags, 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 ` @@ -43,10 +43,10 @@

Code licensed under MIT. Graphics licensed under CC-BY

- + diff --git a/package.json b/package.json index dd45c67d..e5a2ce99 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "version": "1.4.2", + "version": "2.0.0", "name": "twemoji", "license": ["MIT", "CC-BY-4.0"], - "description": "A Unicode standard based way to implement emoji across all platforms.", + "description": "A Unicode 8 standard based way to implement emoji across all platforms.", "homepage": "https://github.com/twitter/twemoji", "keywords": [ "emoji", @@ -25,7 +25,7 @@ "type": "git", "url": "git://github.com/twitter/twemoji.git" }, - "main": "./twemoji.npm.js", + "main": "./2/twemoji.npm.js", "scripts": { "test": "phantomjs testrunner.js" }