Skip to content

Commit

Permalink
fix: 🐛 missing twemoji type (#1190)
Browse files Browse the repository at this point in the history
Closes: #1177
  • Loading branch information
Saul-Mirone authored Dec 11, 2023
1 parent ffac30a commit 5d34fd5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/plugin-emoji/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"node-emoji": "^2.0.0",
"remark-emoji": "^4.0.0",
"tslib": "^2.5.0",
"twemoji": "^14.0.1",
"twemoji": "^14.0.2",
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-emoji/src/__internal__/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import twemoji from 'twemoji'

const setAttr = (text: string) => ({ title: text })

export type TwemojiOptions = Parameters<typeof twemoji.parse>[1]

export function parse(emoji: string, twemojiOptions?: TwemojiOptions): string {
return twemoji.parse(emoji, { attributes: setAttr, base: 'https://cdn.jsdelivr.net/gh/twitter/twemoji/assets/', ...twemojiOptions }) as unknown as string
}
2 changes: 1 addition & 1 deletion packages/plugin-emoji/src/__internal__/remark-twemoji.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { Node, RemarkPluginRaw } from '@milkdown/transformer'
import emojiRegex from 'emoji-regex'

import { parse } from './parse'
import { type TwemojiOptions, parse } from './parse'

const regex = emojiRegex()

Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5d34fd5

Please sign in to comment.