embed-plugin-emoji

5.0.4 • Public • Published

embed-plugin-emoji

A plugin that can be used to convert :emoji_name: to actual emojis.

Installation

npm i -S embed-js embed-plugin-emoji

CDN

https://unpkg.com/embed-plugin-emoji

Usage

Edit embed.js - emoji

It supports all the emojis supported by emoji.css. If you are using this plugin, you need to load

@import url("https://unpkg.com/emoji.css/dist/emoji.min.css") 

In case you want to use a custom CSS, you can change the template by passing a new template in the options.

import EmbedJS from 'embed-js'
import emoji from 'embed-plugin-emoji'
 
const x = new EmbedJS({
  input: document.getElementById('element'),
  plugins: [
  emoji({
    regex: /emojiRegex/gi, // in case you want to define a custom regex
    template(emojiName) {
      // optional template
    }
   })
 ]
})

Known issue : It doesn't check if a particular name is a valid emoji name. So if you use a test like :not_valid_emoji_name:, it will still convert it to a span element with that class name.

License

MIT @ Ritesh Kumar

Readme

Keywords

none

Package Sidebar

Install

npm i embed-plugin-emoji

Weekly Downloads

179

Version

5.0.4

License

MIT

Unpacked Size

20.9 kB

Total Files

9

Last publish

Collaborators

  • ritz078