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>;