Socket
Socket
Sign inDemoInstall

markdown-it-emoji

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-it-emoji

Emoji plugin for markdown-it markdown parser.


Version published
Weekly downloads
357K
increased by10.01%
Maintainers
1
Weekly downloads
 
Created

What is markdown-it-emoji?

The markdown-it-emoji package is a plugin for the markdown-it Markdown parser that allows you to easily include emoji in your Markdown documents. It converts emoji shortcodes (like :smile:) into their corresponding Unicode emoji characters.

What are markdown-it-emoji's main functionalities?

Basic Emoji Conversion

This feature allows you to convert emoji shortcodes into their corresponding Unicode emoji characters. By using the markdown-it-emoji plugin with markdown-it, you can easily include emojis in your Markdown content.

const md = require('markdown-it')();
const emoji = require('markdown-it-emoji');
md.use(emoji);

const result = md.render('I :heart: Markdown!');
console.log(result); // Outputs: <p>I ❤️ Markdown!</p>

Custom Emoji Definitions

This feature allows you to define custom emoji shortcodes and their corresponding Unicode characters. You can extend or override the default emoji definitions provided by the plugin.

const md = require('markdown-it')();
const emoji = require('markdown-it-emoji');
md.use(emoji, {
  defs: {
    smile: '😃',
    custom_emoji: '🚀'
  }
});

const result = md.render('I :smile: using :custom_emoji:!');
console.log(result); // Outputs: <p>I 😃 using 🚀!</p>

Custom Emoji Rendering

This feature allows you to customize the rendering of emojis. You can define how the emojis should be rendered in the final HTML output, such as wrapping them in custom HTML tags or adding CSS classes.

const md = require('markdown-it')();
const emoji = require('markdown-it-emoji');
md.use(emoji, {
  shortcuts: {
    angry: [':angry:', '>:(']
  },
  renderer: function (token, idx) {
    return '<span class="emoji emoji-' + token[idx].markup + '">' + token[idx].content + '</span>';
  }
});

const result = md.render('I am >:( right now!');
console.log(result); // Outputs: <p>I am <span class="emoji emoji-angry">😠</span> right now!</p>

Other packages similar to markdown-it-emoji

Keywords

FAQs

Package last updated on 22 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc