Package Exports
- rehype-twemoji
- rehype-twemoji/dist/index.cjs
- rehype-twemoji/dist/index.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rehype-twemoji) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Rehype Twemoji
A rehype plugin to convert emoji to twemoji.
Install
pnpm i -D rehype-twemoji
Usage
import { rehypeImage } from 'rehype-twemoji'
import type { RehypeImageOptions } from 'rehype-twemoji'
...
{
rehypePlugins: [
[rehypeTwemoji, {
format: 'svg',
source: 'https://cdn.jsdelivr.net/gh/twitter/twemoji@latest',
} satisfies RehypeTwemojiOptions],
]
}
Input:
Hello World 👋
Output:
<p>
Hello World
<img
src="https://cdn.jsdelivr.net/gh/twitter/twemoji@latest/assets/svg/1f44b.svg"
alt="👋"
aria-label="waving hand"
data-twemoji=""
/>
</p>
Options
format
:svg
orpng
(default:svg
)source
: source of twemoji (default:https://cdn.jsdelivr.net/gh/twitter/twemoji@latest
)
Styling
You can use data-twemoji
attribute to style the emoji.
Here is an example of using with Tailwind CSS:
[data-twemoji] {
@apply size-[1.2em] inline-block align-text-bottom;
}
License
MIT