Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dailybothq/universal-emoji-parser
This tool allow parse unicode and emoji codes to html images using emojilib && Twemoji
https://github.com/dailybothq/universal-emoji-parser
emoji emoji-parser github parser slack transform twitter unicode
Last synced: about 23 hours ago
JSON representation
This tool allow parse unicode and emoji codes to html images using emojilib && Twemoji
- Host: GitHub
- URL: https://github.com/dailybothq/universal-emoji-parser
- Owner: DailyBotHQ
- License: mit
- Created: 2019-04-10T00:12:51.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2025-01-07T20:08:31.000Z (1 day ago)
- Last Synced: 2025-01-07T21:19:43.452Z (1 day ago)
- Topics: emoji, emoji-parser, github, parser, slack, transform, twitter, unicode
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/universal-emoji-parser
- Size: 1.86 MB
- Stars: 38
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Universal Emoji Parser
This tool allow parse emojis **char unicodes** and **shortcodes** to html images using [emojilib](https://github.com/muan/emojilib) && [Twemoji](https://github.com/jdecked/twemoji-parser).
This allows emojis to be standard across browsers, and avoid compatibility issues.Emojis Support:
- [Twitter](https://twitter.com/) emojis
- [GitHub](https://github.com/) emojis
- [Slack](https://slack.com/) emojis
- [Discord](https://discord.com/) emojis
- [Google Chat](https://chat.google.com/) emojis
- [Microsoft Teams](https://www.microsoft.com/en-us/microsoft-teams/group-chat-software) emojis---
[![Code Check && Release](https://github.com/DailyBotHQ/universal-emoji-parser/actions/workflows/release_and_publish.yml/badge.svg?branch=main)](https://github.com/DailyBotHQ/universal-emoji-parser/actions/workflows/release_and_publish.yml)
[![GitHub license](https://img.shields.io/github/license/DailyBotHQ/universal-emoji-parser)](https://github.com/DailyBotHQ/universal-emoji-parser/blob/main/LICENSE)
[![GitHub stars](https://img.shields.io/github/stars/DailyBotHQ/universal-emoji-parser)](https://github.com/DailyBotHQ/universal-emoji-parser)
[![Total downloads](https://img.shields.io/npm/dt/universal-emoji-parser.svg)](https://www.npmjs.com/package/universal-emoji-parser)## Installation
```javascript
npm install universal-emoji-parser --saveor
yarn add universal-emoji-parser
```## Usage
```javascript
// ES6 import
â import uEmojiParser from 'universal-emoji-parser'or
// CommonJS require
â const uEmojiParser = require('universal-emoji-parser')
```### Using default options:
```
â uEmojiParser.parse('đ')
``````
â uEmojiParser.parse(':smiling_face_with_sunglasses:')
``````
â uEmojiParser.parse('đ')
``````
â uEmojiParser.parse(':rocket:')
``````
â uEmojiParser.parse('Hello world! đ :smiling_face_with_sunglasses: đ :rocket:')
Hello world!
```### Using method options:
- DEFAULT EMOJI CDN => `https://cdn.jsdelivr.net/gh/jdecked/twemoji@latest/assets/svg/`
| Option Name | Type | Default | Description |
| :--------------- | :------ | :------------------ | :-------------------------------------------------------------------------------------------------------------------- |
| emojiCDN | string | `DEFAULT EMOJI CDN` | Allow customize the emojis CDN. The `parseToHtml` option should be `true` to apply this option. |
| parseToHtml | boolean | `true` | Parse emojis unicodes and shortcodes into html images. |
| parseToUnicode | boolean | `false` | Parse emojis shortcodes into unicodes. The option **parseToHtml** should be `false` to apply. |
| parseToShortcode | boolean | `false` | Parse emojis unicodes into shortcodes. The options **parseToHtml** and **parseToUnicode** should be `false` to apply. |Using different values for options:
```
â uEmojiParser.parse('đ', {})
``````
â uEmojiParser.parse(':smiling_face_with_sunglasses:', { parseToHtml: true })
``````
â uEmojiParser.parse('Hello world! :smiling_face_with_sunglasses: :rocket:', { parseToHtml: false, parseToUnicode: true })
Hello world! đ đ
``````
â uEmojiParser.parse('Hello world! đ đ', { parseToHtml: false, parseToShortcode: true })
Hello world! :smiling_face_with_sunglasses: :rocket:
```Using custom CDN
```
â uEmojiParser.parse('Hello world! đ đ', { emojiCDN: "https://custom.emoji.cdn/gh/jdecked/twemoji@latest/assets/svg/" })
Hello world!
``````
â uEmojiParser.parse('Hello world! đ đ', { parseToHtml: true, emojiCDN: https://custom.emoji.cdn/gh/jdecked/twemoji@latest/assets/svg/ })
Hello world!
``````
â uEmojiParser.parse('Hello world! đ đ', { parseToHtml: false, emojiCDN: "https://custom.emoji.cdn/gh/jdecked/twemoji@latest/assets/svg/" })
Hello world! đ đ
```### âšī¸ Optionally, direct methods can also be used to parse the content of the emojis through the different options:
```
â uEmojiParser.parseToHtml('Hello world! đ :smiling_face_with_sunglasses: đ :rocket:')
Hello world!
``````
â uEmojiParser.parseToUnicode('Hello world! :smiling_face_with_sunglasses: :rocket:')
Hello world! đ đ
``````
â uEmojiParser.parseToShortcode('Hello world! đ đ')
Hello world! :smiling_face_with_sunglasses: :rocket:
```## Get emoji lib json data
You can get the entire emoji lib json data curated and processed to best match with shortcode keywords.
```javascript
// ES6 import
â import { emojiLibJsonData } from 'universal-emoji-parser'or
// CommonJS require
const uEmojiParser = require('universal-emoji-parser')
const { emojiLibJsonData } = uEmojiParser
``````
â Object.keys(emojiLibJsonData).length
1898â emojiLibJsonData[đ¤Ŗ]
{
name: 'rolling on the floor laughing',
slug: 'rolling_on_the_floor_laughing',
group: 'Smileys & Emotion',
emoji_version: '3.0',
unicode_version: '3.0',
skin_tone_support: false,
char: 'đ¤Ŗ',
keywords: [
'rolling_on_the_floor_laughing',
'rolling',
'floor',
'laughing',
'rofl'
]
}â emojiLibJsonData[đ]
{
name: 'smiling face with sunglasses',
slug: 'smiling_face_with_sunglasses',
group: 'Smileys & Emotion',
emoji_version: '1.0',
unicode_version: '1.0',
skin_tone_support: false,
char: 'đ',
keywords: [
'smiling_face_with_sunglasses',
'cool',
'summer',
'beach',
'sunglass'
]
}
```## CSS Styles
To properly scale emojis to fit within their containing elements, you can apply these global CSS styles:
```
img.emoji {
height: 1em;
width: 1em;
margin: 0 0.05em 0 0.1em;
vertical-align: -0.1em;
}
```## :electric_plug: Powered by [DailyBot](https://www.dailybot.com?utm_source=dailybotopensource&utm_medium=universal-emoji-parser)
DailyBot is an [AI Assistant](https://www.dailybot.com/product/ai) powered by ChatGPT that takes chat and collaboration to the next level helping to automate: daily standups, team check-ins, surveys, kudos, virtual watercooler, 1:1 intros, motivation tracking, chatops and more. [Learn more](https://www.dailybot.com?utm_source=dailybotopensource&utm_medium=universal-emoji-parser).
## License
Universal Emoji Parser is [MIT licensed](./LICENSE).