unified

Project: remarkjs/remark-gemoji

Package: remark-gemoji@6.0.0

  1. Dependencies: 0ยทDependents: 6
  2. remark plugin to turn gemoji shortcodes (:+1:) into emoji (๐Ÿ‘)
  1. remark 195
  2. unified 167
  3. markdown 135
  4. plugin 130
  5. mdast 88
  6. remark-plugin 74
  7. github 8
  8. emoji 4
  9. gemoji 2

remark-gemoji

Build Coverage Downloads Size Sponsors Backers Chat

remark plugin to turn gemoji shortcodes (:+1:) into emoji (๐Ÿ‘).

Note!

This plugin is ready for the new parser in remark (micromark, see remarkjs/remark#536). As remark no longer supports โ€œpedanticโ€ mode, this plugin is no longer needed. Hence, this plugin is rewritten to be useful again: it now maps gemoji shortcodes to emoji. This new plugin works with old and new remark.

Install

npm:

npm install remark-gemoji

Use

Say we have the following file, example.md:

Thumbs up: :+1:, thumbs down: :-1:.

Families: :family_man_man_boy_boy:

Long flags: :wales:, :scotland:, :england:.

And our script, example.js, looks as follows:

var vfile = require('to-vfile')
var report = require('vfile-reporter')
var unified = require('unified')
var parse = require('remark-parse')
var gemoji = require('remark-gemoji')
var stringify = require('remark-stringify')

unified()
  .use(parse)
  .use(gemoji)
  .use(stringify)
  .process(vfile.readSync('example.md'), function (err, file) {
    console.error(report(err || file))
    console.log(String(file))
  })

Now, running node example yields:

example.md: no issues found
Thumbs up: ๐Ÿ‘, thumbs down: ๐Ÿ‘Ž.

Families: ๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ

Long flags: ๐Ÿด๓ ง๓ ข๓ ท๓ ฌ๓ ณ๓ ฟ, ๐Ÿด๓ ง๓ ข๓ ณ๓ ฃ๓ ด๓ ฟ, ๐Ÿด๓ ง๓ ข๓ ฅ๓ ฎ๓ ง๓ ฟ.

API

remark().use(gemoji)

Plugin to turn Gemoji shortcodes into emoji.

Security

Use of remark-gemoji does not involve rehype (hast) or user content so there are no openings for cross-site scripting (XSS) attacks.

Contribute

See contributing.md in remarkjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT ยฉ Titus Wormer