From 5a8ae9daf3576c085f311469014c9236143876ef Mon Sep 17 00:00:00 2001 From: taga3s Date: Sun, 22 Dec 2024 12:30:54 +0900 Subject: [PATCH] chore: remove unused remark-plugin --- app/packages/remark-emoji-name/index.ts | 33 ------------------------- app/routes/posts/md-test.mdx | 2 +- vite.config.ts | 3 +-- 3 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 app/packages/remark-emoji-name/index.ts diff --git a/app/packages/remark-emoji-name/index.ts b/app/packages/remark-emoji-name/index.ts deleted file mode 100644 index 97e7249..0000000 --- a/app/packages/remark-emoji-name/index.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type { Root } from "mdast"; -import type { Plugin } from "unified"; -import { visit } from "unist-util-visit"; - -type EmojiMap = { [key: string]: string }; - -const emojiMap: EmojiMap = { - ":heart:": "❤ī¸", - ":ok_hand:": "👌", - ":thumbsup:": "👍", - ":clap:": "👏", - ":pray:": "🙏", - ":muscle:": "đŸ’Ē", - ":white_check_mark:": "✅", -}; - -const remarkEmojiName: Plugin<[], Root> = () => { - const regex = /:[a-zA-Z0-9_]+:/g; - return (tree) => { - visit(tree, "text", (node) => { - const matches = node.value.match(regex); - if (matches) { - for (const match of matches) { - if (emojiMap[match]) { - node.value = node.value.replace(match, emojiMap[match]); - } - } - } - }); - }; -}; - -export default remarkEmojiName; diff --git a/app/routes/posts/md-test.mdx b/app/routes/posts/md-test.mdx index 3ca4a4d..7ccf893 100644 --- a/app/routes/posts/md-test.mdx +++ b/app/routes/posts/md-test.mdx @@ -68,4 +68,4 @@ Class08 <--> C2: Cool label > こぎナイブナãƒĒは、ぞだ開į™ē中です。äēˆæœŸã›ãŦエナãƒŧがį™ēį”Ÿã™ã‚‹å¯čƒŊ性がありぞす。 > [!TIP] -> 原は、こぎã‚ĩイトぎčŖŊäŊœč€…は、ã‚ŋピã‚Ēã‚Ģをäēēį”Ÿã§ä¸€åēĻもéŖŸãšãŸã“とがありぞせん。īŧˆæœŦåŊ“:thumbsup:īŧ‰ +> 原は、こぎã‚ĩイトぎčŖŊäŊœč€…は、ã‚ŋピã‚Ēã‚Ģをäēēį”Ÿã§ä¸€åēĻもéŖŸãšãŸã“とがありぞせん。 diff --git a/vite.config.ts b/vite.config.ts index a3ada26..0e83709 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -11,7 +11,6 @@ import remarkGfm from 'remark-gfm' import rehypeMomiji from './app/packages/rehype-momiji' import remarkMomijiCodeFilename from './app/packages/remark-momiji-filename' import rehypeMermaid from './app/packages/rehype-mermaid/rehypeMermaid' -import remarkEmojiName from './app/packages/remark-emoji-name' import { remarkAttentionBlock } from './app/packages/remark-attention-block' import { rehypeAttentionBlock } from './app/packages/rehype-attention-block' @@ -26,7 +25,7 @@ export default defineConfig(() => { ssg({ entry: "./app/server.ts" }), mdx({ jsxImportSource: 'hono/jsx', - remarkPlugins: [remarkGfm, remarkBreaks, remarkFrontmatter, remarkMdxFrontmatter, remarkMomijiCodeFilename, remarkEmojiName, remarkAttentionBlock], + remarkPlugins: [remarkGfm, remarkBreaks, remarkFrontmatter, remarkMdxFrontmatter, remarkMomijiCodeFilename, remarkAttentionBlock], rehypePlugins: [[rehypeMomiji, { excludeLangs: ['mermaid'] }], rehypeMermaid, rehypeAttentionBlock], }) ],