{"id":13485081,"url":"https://github.com/rhysd/remark-emoji","last_synced_at":"2025-05-16T11:06:11.303Z","repository":{"id":38550241,"uuid":"69729613","full_name":"rhysd/remark-emoji","owner":"rhysd","description":"Remark markdown transformer to replace :emoji: in text","archived":false,"fork":false,"pushed_at":"2024-07-18T11:38:41.000Z","size":692,"stargazers_count":138,"open_issues_count":4,"forks_count":20,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-08T00:51:54.608Z","etag":null,"topics":["emoji","remark","remark-plugin"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhysd.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-01T09:15:15.000Z","updated_at":"2025-05-02T11:20:05.000Z","dependencies_parsed_at":"2023-02-15T09:46:05.262Z","dependency_job_id":"9651a448-d8a6-44ae-91c0-ef3adfcbd8b9","html_url":"https://github.com/rhysd/remark-emoji","commit_stats":{"total_commits":155,"total_committers":9,"mean_commits":17.22222222222222,"dds":"0.18709677419354842","last_synced_commit":"eef13321d125e7816ffd604f83eed30e5c1e5089"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Fremark-emoji","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Fremark-emoji/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Fremark-emoji/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Fremark-emoji/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhysd","download_url":"https://codeload.github.com/rhysd/remark-emoji/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253365314,"owners_count":21897181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emoji","remark","remark-plugin"],"created_at":"2024-07-31T17:01:45.242Z","updated_at":"2025-05-16T11:06:06.286Z","avatar_url":"https://github.com/rhysd.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","JavaScript"],"sub_categories":[],"readme":"remark-emoji\n============\n[![CI][ci-badge]][ci]\n[![npm][npm-badge]][npm]\n\n[remark-emoji][npm] is a [remark](https://github.com/remarkjs/remark) plugin to replace `:emoji:` to real UTF-8\nemojis in Markdown text. This plugin is built on top of [node-emoji](https://www.npmjs.com/package/node-emoji).\nThe accessibility support and [Emoticon](https://en.wikipedia.org/wiki/Emoticon) support are optionally available.\n\n## Demo\n\nYou can find a demo in the following [Codesandbox](https://codesandbox.io/p/sandbox/remark-emoji-example-w6yrmm).\n\n## Usage\n\n```\nremark().use(emoji [, options]);\n```\n\n```javascript\nimport { remark } from 'remark';\nimport emoji from 'remark-emoji';\n\nconst doc = 'Emojis in this text will be replaced: :dog::+1:';\nconst processor = remark().use(emoji);\nconst file = await processor.process(doc);\n\nconsole.log(String(file));\n// =\u003e Emojis in this text will be replaced: 🐶👍\n```\n\nNote:\n\n- This package is [ESM only][esm-only] from v3.0.0 since remark packages migrated to ESM.\n- This package supports Node.js v18 or later.\n\n## Options\n\n### `options.accessible`\n\nSetting to `true` makes the converted emoji text accessible with `role` and `aria-label` attributes. Each emoji\ntext is wrapped with `\u003cspan\u003e` element. The `role` and `aria-label` attribute are not allowed by default. Please\nadd them to the sanitization schema used by remark's HTML transformer. The default sanitization schema is exported\nfrom [rehype-sanitize](https://www.npmjs.com/package/rehype-sanitize) package.\n\nFor example,\n\n```javascript\nimport remarkParse from 'remark-parse';\nimport toRehype from 'remark-rehype';\nimport sanitize, { defaultSchema } from 'rehype-sanitize';\nimport stringify from 'rehype-stringify';\nimport emoji from 'remark-emoji';\nimport { unified } from 'unified';\n\n// Allow using `role` and `aria-label` attributes in transformed HTML document\nconst schema = structuredClone(defaultSchema);\nif ('span' in schema.attributes) {\n    schema.attributes.span.push('role', 'ariaLabel');\n} else {\n    schema.attributes.span = ['role', 'ariaLabel'];\n}\n\n// Markdown text processor pipeline\nconst processor = unified()\n    .use(remarkParse)\n    .use(emoji, { accessible: true })\n    .use(toRehype)\n    .use(sanitize, schema)\n    .use(stringify);\n\nconst file = await processor.process('Hello :dog:!');\nconsole.log(String(file));\n```\n\nyields\n\n```html\nHello \u003cspan role=\"img\" aria-label=\"dog emoji\"\u003e🐶\u003c/span\u003e!\n```\n\nDefault value is `false`.\n\n### `options.padSpaceAfter`\n\nSetting to `true` means that an extra whitespace is added after emoji.\nThis is useful when browser handle emojis with half character length and following character is hidden.\nDefault value is `false`.\n\n### `options.emoticon`\n\nSetting to `true` means that [emoticon](https://www.npmjs.com/package/emoticon) shortcodes are supported (e.g. :-)\nwill be replaced by 😃). Default value is `false`.\n\n## TypeScript support\n\nremark-emoji package contains [TypeScript](https://www.typescriptlang.org/) type definitions. The package is ready\nfor use with TypeScript.\n\nNote that the legacy `node` (or `node10`) resolution at [`moduleResolution`](https://www.typescriptlang.org/tsconfig#moduleResolution)\nis not available since it enforces CommonJS module resolution and this package is ESM only. Please use `node16`,\n`bundler`, or `nodenext` to enable ESM module resolution.\n\n## License\n\nDistributed under [the MIT License](LICENSE).\n\n\n\n[ci-badge]: https://github.com/rhysd/remark-emoji/actions/workflows/ci.yml/badge.svg\n[ci]: https://github.com/rhysd/remark-emoji/actions/workflows/ci.yml\n[npm-badge]: https://badge.fury.io/js/remark-emoji.svg\n[npm]: https://www.npmjs.com/package/remark-emoji\n[esm-only]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhysd%2Fremark-emoji","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhysd%2Fremark-emoji","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhysd%2Fremark-emoji/lists"}