close
The Wayback Machine - https://web.archive.org/web/20201008111326/https://github.com/remarkjs/remark-gemoji
Skip to content
main
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

readme.md

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.

Related

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

You can’t perform that action at this time.