Skip to content

pantoken / renderers/react-markdown/src / rehypeColorCodes

Hàm: rehypeColorCodes()

rehypeColorCodes(): (tree) => void

Beta

Một plugin rehype bao bọc các giá trị màu đơn lẻ trong <span data-color-code="…">, để lớp React có thể hiển thị một mẫu màu. Phản chiếu pipeline icon-token.

Trả về

(tree) => void

Ví dụ

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

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