Skip to content

pantoken / renderers/react-markdown/src / rehypeColorCodes

ฟังก์ชัน: rehypeColorCodes()

rehypeColorCodes(): (tree) => void

เบต้า

ปลั๊กอิน rehype ที่ห่อค่ารหัสสีแบบสแตนด์อโลนด้วย <span data-color-code="…"> เพื่อให้เลเยอร์ React สามารถเรนเดอร์ตัวอย่างสีได้ ทำงานสอดคล้องกับ pipeline ของ icon-token.

คืนค่า

(tree) => void

ตัวอย่าง

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

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