Skip to content

pantoken / renderers/react-markdown/src / rehypeGithubAlerts

Hàm: rehypeGithubAlerts()

rehypeGithubAlerts(): (tree) => void

Beta

Một plugin rehype gắn thẻ các blockquote cảnh báo GitHub: nó phát hiện một marker kiểu [!NOTE] ở đầu một blockquote, lưu nó dưới tên data-alert="note", và loại bỏ văn bản marker. Thành phần React blockquote sau đó hiển thị một Alert của InstUI.

Trả về

(tree) => void

Ví dụ

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

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