/nomoji

Replace emojis in text with SVG images

Primary LanguageJavaScriptCreative Commons Attribution Share Alike 4.0 InternationalCC-BY-SA-4.0

nomoji

Replace emojis in text with SVG images (https://openmoji.org)

installation

npm i nomoji

usage

nomoji(text, [prefix], [disableSanitation])

nomoji('Hello from 🇫🇮')
Hello from <img draggable="false" class="emoji" src="svg/1f1eb_1f1ee.svg">

The optional prefix parameter defines where to find image files

nomoji('Hello from 🇫🇮', 'nomoji/')
Hello from <img draggable="false" class="emoji" src="nomoji/svg/1f1eb_1f1ee.svg">

The optional disableSanitation parameter disables HTML sanitation

nomoji('Hello <b>HTML</b> 🤩!');
Hello &#60;b&#62;HTML&#60;/b&#62; <img draggable="false" class="emoji" src="svg/1f929.svg">!
nomoji('Hello <b>HTML</b> 🤩!', null, true);
Hello <b>HTML</b> <img draggable="false" class="emoji" src="dist/svg/1f929.svg">!

license

Code is licensed with MIT license, graphics (OpenMoji) are licensed with CC-BY-SA-4.0 license