Skip to content

pantoken / renderers/react-markdown/src / rehypeGithubAlerts

関数: rehypeGithubAlerts()

rehypeGithubAlerts(): (tree) => void

ベータ

GitHub アラートの引用ブロックにタグを付ける rehype プラグイン: 引用ブロックの先頭で [!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>;