Skip to content

pantoken / renderers/react-markdown/src / rehypeGithubAlerts

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

rehypeGithubAlerts(): (tree) => void

เบต้า

ปลั๊กอิน rehype ที่ติดแท็กบล็อกคำพูดเตือนของ GitHub: มันตรวจหาเครื่องหมายสไตล์ [!NOTE] ที่ จุดเริ่มต้นของบล็อกคำพูด, บันทึกเป็น data-alert="note" และลบข้อความเครื่องหมายนั้นออก The React blockquote component แล้วจึงเรนเดอร์ InstUI Alert.

คืนค่า

(tree) => void

ตัวอย่าง

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

<Markdown rehypePlugins={[rehypeGithubAlerts]}>{"> [!NOTE]\n> Heads up."}</Markdown>;