Skip to content

pantoken / renderers/react-markdown/src / rehypeGithubAlerts

函式: rehypeGithubAlerts()

rehypeGithubAlerts(): (tree) => void

Beta(測試)

一個 rehype 插件,用於標記 GitHub 警示引用區塊:它會偵測到類似 [!NOTE] 的標記位於 引用區塊的開頭,將其記錄為 data-alert="note",並移除該標記文字。React blockquote 元件然後渲染一個 InstUI 的 Alert

回傳

(tree) => void

範例

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

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