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>;