remark-gemoji
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
remark-gfm
โ GitHub Flavored Markdownremark-github
โ Auto-link references like in GitHub issues, PRs, and commentsremark-footnotes
โ Footnotesremark-frontmatter
โ Frontmatter (YAML, TOML, and more) supportremark-math
โ Math
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