Coder Social home page Coder Social logo

zubiden / twemoji-parser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jdecked/twemoji-parser

0.0 0.0 0.0 255 KB

A simple library for identifying emoji entities within a string in order to render them as Twemoji.

License: MIT License

Shell 11.22% JavaScript 30.09% Scala 55.14% Starlark 1.80% Mustache 1.76%

twemoji-parser's Introduction

Twemoji Parser

A simple library for identifying emoji entities within a string in order to render them as Twemoji.

For example, this parser is used within the rendering flow for Tweets and other text on mobile.twitter.com

Setup

Important

The twemoji-parser package is now being published as @twemoji/parser

Add @twemoji/parser as a dependency to your project:

yarn add @twemoji/parser

Or, to work directly in this repo, clone it and run yarn install from the repo root.

Usage

The tests are intended to serve as a more exhaustive source of documentation, but the general idea is that the parser takes a string and returns an array of the emoji entities it finds:

import { parse } from '@twemoji/parser';
const entities = parse('I 🧡 Twemoji! 🥳');
/*
entities = [
  {
    url: 'https://cdn.jsdelivr.net/gh/jdecked/twemoji@latest/assets/svg/1f9e1.svg',
    indices: [ 2, 4 ],
    text: '🧡',
    type: 'emoji'
  },
  {
    url: 'https://cdn.jsdelivr.net/gh/jdecked/twemoji@latest/assets/svg/1f973.svg',
    indices: [ 12, 14 ],
    text: '🥳',
    type: 'emoji'
  }
]
*/

Authors

  • Nathan Downs <ndowns [at] twitter [dot] com>

Contributing

We feel that a welcoming community is important and we ask that you follow Twitter's Open Source Code of Conduct in all interactions with the community.

Support

Create a new issue on GitHub.

Security Issues?

Please report sensitive security issues via Twitter's bug-bounty program (https://hackerone.com/twitter) rather than GitHub.

License

MIT https://github.com/jdecked/twemoji-parser/blob/master/LICENSE.md

twemoji-parser's People

Contributors

jdecked avatar andypiper avatar thatonecalculator avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.