1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-06-15 03:35:16 +00:00

Disabled African requesting equal justification

Skip to content
Your account has been flagged.
Because of that, your profile is hidden from the public. If you believe this is a mistake, contact support to have your account status reviewed.
davidlwpblo
/
twemoji
forked from twitter/twemoji
Emoji for everyone. https://twemoji.twitter.com/

 View license
 0 stars  1.4k forks
Code
Pull requests
Actions
Projects
Security
Insights
Settings
 Public repositories in your account are currently limited to existing users 6 months remaining
Users that have recently created their account will be unable to interact with the repository.

 New users
 Users
 Contributors
 Collaborators
 or view interaction limit settings
This branch is 5 commits behind twitter:master.
 Pull request
 Compare
Latest commit
@goooseman
@jdecked
goooseman and jdecked
…
22 days ago
Git stats
Files
README.md
Twitter Emoji (Twemoji) Build Status
A simple library that provides standard Unicode emoji support across all platforms.

Twemoji v13.0 adheres to the Unicode 13.0 spec and supports the Emoji 13.0 spec

The Twemoji library offers support for 3,304 emojis.

Usage
CDN Support
The folks over at MaxCDN have graciously provided CDN support.

Use the following in the <head> tag of your HTML document(s):

<script src="https://twemoji.maxcdn.com/v/latest/twemoji.min.js" crossorigin="anonymous"></script>
This guarantees that you will always use the latest version of the library.

If, instead, you'd like to include the latest version explicitly, you can add the following tag:

<script src="https://twemoji.maxcdn.com/v/13.0.1/twemoji.min.js" integrity="sha384-5f4X0lBluNY/Ib4VhGx0Pf6iDCF99VGXJIyYy7dDLY5QlEd7Ap0hICSSZA1XYbc4" crossorigin="anonymous"></script>
Download
If instead you want to download a specific version, please look at the gh-pages branch, where you will find the built assets for both our latest and older versions.

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.

Although there are two kinds of parsing supported by this utility, we recommend you use DOM parsing, explained below. Each type of parsing accepts a callback to generate an image source or an options object with parsing info.

The second kind of parsing is string parsing, explained in the legacy documentation here. This is unrecommended because this method does not sanitize the string or otherwise prevent malicious code from being executed; such sanitization is out of scope.

DOM parsing
If the first argument to twemoji.parse is an HTMLElement, generated image tags will replace emoji that are inside #text nodes only without compromising surrounding nodes or listeners, and completely avoiding the usage of innerHTML.

If security is a major concern, this parsing can be considered the safest option but with a slight performance penalty due to DOM operations that are inevitably costly.

var div = document.createElement('div');
div.textContent = 'I \u2764\uFE0F emoji!';
document.body.appendChild(div);

twemoji.parse(document.body);

var img = div.querySelector('img');

// note the div is preserved
img.parentNode === div; // true

img.src;        // https://twemoji.maxcdn.com/v/latest/72x72/2764.png
img.alt;        // \u2764\uFE0F
img.className;  // emoji
img.draggable;  // false
All other overloads described for string are available in exactly the same way for DOM parsing.

Object as parameter
Here's the list of properties accepted by the optional object that can be passed to the parse function.

  {
    callback: Function,   // default the common replacer
    attributes: Function, // default returns {}
    base: string,         // default MaxCDN
    ext: string,          // default ".png"
    className: string,    // default "emoji"
    size: string|number,  // default "72x72"
    folder: string        // in case it's specified
                          // it replaces .size info, if any
  }
callback
The function to invoke in order to generate image src(s).

By default it is a function like the following one:

function imageSourceGenerator(icon, options) {
  return ''.concat(
    options.base, // by default Twitter Inc. CDN
    options.size, // by default "72x72" string
    '/',
    icon,         // the found emoji as code point
    options.ext   // by default ".png"
  );
}
base
The default url is the same as twemoji.base, so if you modify the former, it will reflect as default for all parsed strings or nodes.

ext
The default image extension is the same as twemoji.ext which is ".png".

If you modify the former, it will reflect as default for all parsed strings or nodes.

className
The default class for each generated image is emoji. It is possible to specify a different one through this property.

size
The default asset size is the same as twemoji.size which is "72x72".

If you modify the former, it will reflect as default for all parsed strings or nodes.

folder
In case you don't want to specify a size for the image. It is possible to choose a folder, as in the case of SVG emoji.

twemoji.parse(genericNode, {
  folder: 'svg',
  ext: '.svg'
});
This will generate urls such https://twemoji.maxcdn.com/svg/2764.svg instead of using a specific size based image.

Utilities
Basic utilities / helpers to convert code points to JavaScript surrogates and vice versa.

twemoji.convert.fromCodePoint()
For a given HEX codepoint, returns UTF-16 surrogate pairs.

twemoji.convert.fromCodePoint('1f1e8');
 // "\ud83c\udde8"
twemoji.convert.toCodePoint()
For given UTF-16 surrogate pairs, returns the equivalent HEX codepoint.

 twemoji.convert.toCodePoint('\ud83c\udde8\ud83c\uddf3');
 // "1f1e8-1f1f3"

 twemoji.convert.toCodePoint('\ud83c\udde8\ud83c\uddf3', '~');
 // "1f1e8~1f1f3"
Tips
Inline Styles
If you'd like to size the emoji according to the surrounding text, you can add the following CSS to your stylesheet:

img.emoji {
   height: 1em;
   width: 1em;
   margin: 0 .05em 0 .1em;
   vertical-align: -0.1em;
}
This will make sure emoji derive their width and height from the font-size of the text they're shown with. It also adds just a little bit of space before and after each emoji, and pulls them upwards a little bit for better optical alignment.

UTF-8 Character Set
To properly support emoji, the document character set must be set to UTF-8. This can done by including the following meta tag in the document <head>

<meta charset="utf-8">
Exclude Characters (V1)
To exclude certain characters from being replaced by twemoji.js, call twemoji.parse() with a callback, returning false for the specific unicode icon. For example:

twemoji.parse(document.body, {
    callback: function(icon, options, variant) {
        switch ( icon ) {
            case 'a9':      // © copyright
            case 'ae':      // ® registered trademark
            case '2122':    // ™ trademark
                return false;
        }
        return ''.concat(options.base, options.size, '/', icon, options.ext);
    }
});
Legacy API (V1)
If you're still using our V1 API, you can read our legacy documentation here.

Contributing
The contributing documentation can be found here.

Attribution Requirements
As an open source project, attribution is critical from a legal, practical and motivational perspective in our opinion. The graphics are licensed under the CC-BY 4.0 which has a pretty good guide on best practices for attribution.

However, we consider the guide a bit onerous and as a project, will accept a mention in a project README or an 'About' section or footer on a website. In mobile applications, a common place would be in the Settings/About section (for example, see the mobile Twitter application Settings->About->Legal section). We would consider a mention in the HTML/JS source sufficient also.

Community Projects
Twemoji Amazing by @SebastianAigner: Use Twemoji using CSS classes (like Font Awesome).
Twemoji Ruby by @JollyGoodCode: Use Twemoji in Ruby.
Twemoji for Pencil by @Nathanielnw: Use Twemoji in Pencil.
FrwTwemoji - Twemoji in dotnet by @FrenchW: Use Twemoji in any dotnet project (C#, asp.net ...).
Emojiawesome - Twemoji for Yellow by @datenstrom: Use Twemoji on your website.
EmojiPanel for Twitter by @danielbovey: Insert Twemoji into your tweets on twitter.com.
Twitter Color Emoji font by @bderickson: Use Twemoji as your system default font on Linux & OS X.
Emojica by @xoudini: An iOS framework allowing you to replace all standard emoji in strings with Twemoji.
gwt-twemoji by @nbartels: Use Twemoji in GWT
JavaFXEmojiTextFlow by @pavlobu: A JavaFX library allowing you to replace all standard emoji in extended EmojiTextFlow with Twemoji.
Vue Twemoji Picker by @kevinfaguiar: A fast plug-n-play Twemoji Picker (+textarea for Twemoji rendering) for Vue.
[Unmaintained] Twemoji Awesome by @ellekasai: Use Twemoji using CSS classes (like Font Awesome).
EmojiOnRoku by @KasperGam: Use Twemoji on Roku!
LaTeX Twemoji by @rossel.jost: Use Twemoji in LaTeX.
Committers and Contributors
Bryan Haggerty (Twitter)
Justine De Caires (Twitter)
Nathan Downs (ex-Twitter)
Tom Wuttke (ex-Twitter)
Andrea Giammarchi (ex-Twitter)
Joen Asmussen (WordPress)
Marcus Kazmierczak (WordPress)
The goal of this project is to simply provide emoji for everyone. We definitely welcome improvements and fixes, but we may not merge every pull request suggested by the community due to the simple nature of the project.

The rules for contributing are available in the CONTRIBUTING.md file.

Thank you to all of our contributors.

License
Copyright 2019 Twitter, Inc and other contributors

Code licensed under the MIT License: http://opensource.org/licenses/MIT

Graphics licensed under CC-BY 4.0: https://creativecommons.org/licenses/by/4.0/

Releases
 68 tags
Create a new release
Packages
No packages published
Publish your first package
Languages
HTML
74.0%
 
JavaScript
25.7%
 
Shell
0.3%
© 2021 GitHub, Inc.
Terms
Privacy
Security
Status
Docs
Contact GitHub
Pricing
API
Training
Blog
About
Honestly to tell you the truth I am going through a revaluating these things that who prior previously passed them on to me without my consent of unawareness of what it contains it seem very inappropriate and I want my hands washed with it because this is unfair to falsify something accusing someone of anything that they're not capable of I have verified on many different occasions through reports since day one on this platform which is you can verify by researching all of my reports I want this removed if it can't be removed I want to completely cleared of any inappropriate entities or properties because I have no condenses of what this may contain
This commit is contained in:
David Lee Williams Pablo 2021-03-27 20:31:11 -04:00 committed by GitHub
parent 21c0f5cc0c
commit 8d1323e422
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,101 +0,0 @@
# Contributing Guidelines
Looking to contribute something? Here's how you can help.
## Bugs reports
A bug is a _demonstrable problem_ that is caused by the code in the
repository. Good bug reports are extremely helpful - thank you!
Guidelines for bug reports:
1. **Use the GitHub issue search** &mdash; check if the issue has already been
reported.
2. **Check if the issue has been fixed** &mdash; try to reproduce it using the
latest `master` or development branch in the repository.
3. **Isolate the problem** &mdash; ideally create a reduced test
case and a live example.
4. Please try to be as detailed as possible in your report. Include specific
information about the environment - operating system and version, browser
and version... and steps required to reproduce the issue.
## Feature requests & contribution enquiries
Feature requests are welcome. But take a moment to find out whether your idea
fits with the scope and aims of the project. It's up to *you* to make a strong
case for the inclusion of your feature. Please provide as much detail and
context as possible.
Contribution enquiries should take place before any significant pull request,
otherwise you risk spending a lot of time working on something that we might
have good reasons for rejecting.
## Making Changes
If you'd like to test and/or contribute please follow these instructions.
[Fork this repo on GitHub](https://github.com/twitter/twemoji.git/fork)
### Setup
```bash
# clone your fork
git clone -b master https://github.com/$YOUR_USERNAME/twemoji.git/
cd twemoji
# install dependencies
yarn install
# Build and test your installation
yarn build
yarn test
```
### Making changes
Make sure to adhere to the coding conventions used throughout the codebase
(indentation, accurate comments, etc.) and any other requirements (such as test
coverage).
Please follow this process; it's the best way to get your work included in the
project:
1. Create a new topic branch to contain your feature, change, or fix:
> If you'd like to test and/or propose some changes to the latest library version please change the `./scripts/build.js` file at its end so that everything will be generated properly once launched.
1. Commit your changes in logical chunks. Provide clear and explanatory commit
messages. Use git's [interactive rebase](https://help.github.com/en/articles/about-git-rebase)
feature to tidy up your commits before making them public.
2. Run `yarn prepublish`. This will do several things:
1. Ask for the version number (See: [SemVer](https://semver.org/))
2. Build the project and put the built assets in `dist/`
3. Run the tests
4. Move the contents of the `dist/` directory to the `gh-pages` branch
5. Place the contents of the `dist/` directory in its correspoding versioned folder.
6. Commit the changes and push them to the `gh-pages` branch of your fork.
## Pull requests
Good pull requests - patches, improvements, new features - are a fantastic
help. They should remain focused in scope and avoid containing unrelated
commits.
1. Push your topic branch up to your fork: `git push origin my-feature-branch`
2. [Open a Pull Request](http://help.github.com/send-pull-requests/) with a
clear title and description. One for your changes in `master` and another one for
your changes in `gh-pages`.
## License
By contributing your code:
You agree to license your contribution under the terms of the MIT (for code) and CC-BY (for graphics) licenses
<https://github.com/twitter/twemoji/blob/gh-pages/LICENSE>
<https://github.com/twitter/twemoji/blob/gh-pages/LICENSE-GRAPHICS>