Socket
Book a DemoInstallSign in
Socket

@fedikit/rehype-custom-emoji

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fedikit/rehype-custom-emoji

Rehype plugin to support custom emoji (emojo)

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

@fedikit/rehype-custom-emoji

Rehype plugin to support custom emoji (emojo)

Use

import { rehype } from 'rehype'
import { rehypeCustomEmoji, all, category, one, oneMisskey } from '@fedikit/rehype-custom-emoji'

const file = await rehype()
  .use(rehypeCustomEmoji, {
    emojis: [
      // user defined
      {
        shortcode: 'custom_emoji',
        url: 'https://example.com/custom_emoji.png',
      },
      // get all emoji from mastodon instance
      ...(await all('https://mastodon.social')),
      // get category-specific emoji from mastodon instance
      ...(await category('https://mozilla.social', 'Mozilla')),
      // get a specific emoji from mastodon instance
      ...(await one('https://m.webtoo.ls', 'vitest')),
      // get a specific emoji from misskey instance
      ...(await oneMisskey('https://misskey.io', 'ai_acid_misskeyio'))
    ],
  })
  .process(':custom_emoji:')

// <picture>
//   <source media="(prefers-reduced-motion: no-preference)" srcset="https://example.com/custom_emoji.png">
//   <img alt=":custom_emoji:" src="https://example.com/custom_emoji.png" style="aspect-ratio:1/1;height:1em;vertical-align:text-top" title=":custom_emoji:">
// </picture>
console.log(String(file))

Keywords

custom emoji

FAQs

Package last updated on 16 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts