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