npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rehype-github-emoji

v1.0.0

Published

rehype plugin to enhance emoji and gemoji

Downloads

3,229

Readme

rehype-github-emoji

Build Coverage Downloads Size Sponsors Backers Chat

rehype plugin to enhance emoji and gemoji.

Contents

What is this?

This plugin enhances unicode emoji (👍), gemoji shortcodes (:+1:), and custom gemoji (:shipit:, :shipit:). By default it wraps them with a custom element, specific to GitHub, which you will want to change.

This plugin is part of a monorepo rehype-github. See its readme for more info.

When should I use this?

You can use this plugin when you want to match how github.com works or when you want to build similar pipelines that enhance emoji.

Install

This package is ESM only. In Node.js (version 16+), install with npm:

npm install rehype-github-emoji

In Deno with esm.sh:

import rehypeGithubEmoji from 'https://esm.sh/rehype-github-emoji@1'

In browsers with esm.sh:

<script type="module">
  import rehypeGithubEmoji from 'https://esm.sh/rehype-github-emoji@1?bundle'
</script>

Use

Say our module example.js looks as follows:

import rehypeGithubEmoji from 'rehype-github-emoji'
import rehypeParse from 'rehype-parse'
import rehypeStringify from 'rehype-stringify'
import {unified} from 'unified'

const file = await unified()
  .use(rehypeParse, {fragment: true})
  .use(rehypeGithubEmoji)
  .use(rehypeStringify)
  .process(':shipit: 👍')

console.log(String(file))

…now running node example.js yields:

<img class="emoji" title=":shipit:" alt=":shipit:" src="https://github.githubassets.com/images/icons/emoji/shipit.png" height="20" width="20" align="absmiddle"> 👍

API

This package exports the identifiers defaultBuild, defaultCustom, and defaultIgnore. The default export is rehypeGithubEmoji.

defaultBuild(info, value)

The default builder to turn an emoji or gemoji into rich content.

Parameters
  • info (Gemoji or string) — info on the known emoji or gemoji, or the custom gemoji name
  • value (string) — literal match the way it was written
Returns

Markup for the emoji or gemoji (Element).

defaultCustom

Default custom gemoji names (Array<string>).

defaultIgnore

Default tests for elements to not enhance (Array<string>).

rehypeGithubEmoji(options?)

Plugin to enhance emoji and gemoji.

Parameters
  • options (Options, optional) — configuration

Build

Make rich content from an emoji or a gemoji (TypeScript type).

Parameters
  • info (Gemoji or string) — info on the known emoji or gemoji, or the custom gemoji name
  • value (string) — literal match the way it was written
Returns

Rich content (ElementContent, Array<ElementContent>, false).

Gemoji

Info on an emoji (TypeScript type).

Fields
  • emoji (string) — example: '😀'
  • names (Array<string>) — example: ['grinning']
  • tags (Array<string>) — example: ['smile', 'happy']
  • description (string) — example: 'grinning face'
  • category (string) — example: 'Smileys & Emotion'

Options

Configuration (TypeScript type).

Fields
  • build (Build, default: defaultBuild) — make rich content from an emoji or a gemoji
  • custom (Array<string>, default: defaultCustom) — custom gemoji names to enable without colons, such as ['shipit']; the default is to enable ±20 custom GitHub-specific shortcodes
  • ignore (Test, default: defaultIgnore) — custom test for elements to not enhance; the default is to ignore pre, code, tt, and g-emoji

Authoring

If you want the text representation of an emoji, add VS 15 (\uFE0E) after it.

See § Writing on GitHub for more info.

HTML

The markup for known emoji on github.com used to be a g-emoji but is now just the unicide itself:

👍

For custom emoji, they generate:

<img class="emoji" title=":shipit:" alt=":shipit:" src="https://github.githubassets.com/images/icons/emoji/shipit.png" height="20" width="20" align="absmiddle">

You could generate a g-emoji and enhance custom element (such as with @github/g-emoji-element) or you can generate anything you want.

CSS

The following CSS is needed to make emoji markup look like GitHub.

.emoji {
  background-color: transparent;
  box-sizing: content-box;
  vertical-align: text-top;
}

Syntax

The syntax for emoji and gemoji cannot be captured in BNF. Or at least, it doesn’t get more readable than the source code. Check out lib/index.js for how things work!

Types

This package is fully typed with TypeScript. It exports the additional types Build, Gemoji, and Options.

Compatibility

Projects maintained by the unified collective are compatible with all maintained versions of Node.js. As of now, that is Node.js 16+. Our projects sometimes work with older versions, but this is not guaranteed.

This plugin works with rehype-parse version 3+, rehype-stringify version 3+, rehype version 5+, and unified version 6+.

Security

This package is safe. The build option is unsafe when used with user content as it allows for arbitrary HTML.

Related

Contribute

See contributing.md in rehypejs/.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.

Notice

This project is not affiliated with GitHub.

License

MIT © Titus Wormer