🙊 Text-emoji-parser

What does it do ?

Installation

npm i text-emoji-parser --save

Demo (dist/index.html)

Click Here for Demo

Basic Usage

import React from 'react';
import ReactDOM from 'react-dom';
import {MultiLineParser} from 'text-emoji-parser';
import { Emoji } from 'emoji-mart' // you can use this or any other emoji library i recommend this though 
const title = 'Some text :santa::skin-tone-3: with:smiley: xD \n new line \n some more text on new line';

let ParsedNode=MultiLineParser(title,
                               {
                                  SplitLinesTag:'p',
                                  Rule:/(?:\:[^\:]+\:(?:\:skin-tone-(?:\d)\:)?)/gi
                                },
                                (EmojiTextMatchingRule,ruleNumber)=>{
                                        console.log(Rule)
                                        return <Emoji emoji={EmojiTextMatchingRule} size={48}/>
                                });

ReactDOM.render(
  <div> {ParsedNode} </div>,
  document.getElementById('app')
);

API

SimpleParser

import {SimpleParser} from 'text-emoji-parser';

MultiLineParser

import {MultiLineParser} from 'text-emoji-parser';

Tech

Created by :

Dasith Kuruppu