31 lines
783 B
Markdown
31 lines
783 B
Markdown
|
# custom emoji plugin for rehype
|
||
|
|
||
|
yeah i'm not writing an actual readme for this yet lmao
|
||
|
|
||
|
## usage
|
||
|
|
||
|
```js
|
||
|
import { unified } from "unified";
|
||
|
import remarkParse from "remark-parse";
|
||
|
import rehypeStringify from "rehype-stringify";
|
||
|
import remarkRehype from "remark-rehype";
|
||
|
import rehypeCustomEmoji from "rehype-custom-emoji-plugin";
|
||
|
|
||
|
import jsonfileData from "./emojis.json" with { type: "json" };
|
||
|
|
||
|
const processor = unified()
|
||
|
.use(remarkParse)
|
||
|
.use(remarkRehype)
|
||
|
.use(rehypeCustomEmoji, {
|
||
|
emojis: jsonfileData.emojis,
|
||
|
sourceFile: jsonfileData.source,
|
||
|
hidpiSourceFile: jsonfileData.hidpiSource,
|
||
|
size: jsonfileData.size,
|
||
|
})
|
||
|
.use(rehypeStringify);
|
||
|
|
||
|
const file = await processor.process(":neofox:");
|
||
|
```
|
||
|
|
||
|
generate a spritesheet file with `generate/generate.js`
|