Skip to content

pantoken / renderers/react-markdown/src / rehypeColorCodes

関数: rehypeColorCodes()

rehypeColorCodes(): (tree) => void

ベータ

単独の色値を <span data-color-code="…"> でラップする rehype プラグインで、React レイヤーがスウォッチをレンダリングできるようにします。アイコン・トークンのパイプラインを反映しています。

戻り値

(tree) => void

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

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