Skip to content

pantoken / renderers/react-markdown/src / rehypeColorCodes

函数: rehypeColorCodes()

rehypeColorCodes(): (tree) => void

Beta

一个 rehype 插件,会将独立的颜色值包装在 <span data-color-code="…"> 中,以便 React 层 可以 渲染 一个 色块。与 icon-token 管道相对应。

返回值

(tree) => void

示例

tsx
import Markdown from "react-markdown";
import { rehypeColorCodes } from "@pantoken/react-markdown";

<Markdown rehypePlugins={[rehypeColorCodes]}>Brand is #03893D.</Markdown>;