Skip to content

pantoken / renderers/react-markdown/src / rehypeGithubAlerts

Función: rehypeGithubAlerts()

rehypeGithubAlerts(): (tree) => void

Beta

Un plugin de rehype que etiqueta las citas en bloque de alerta de GitHub: detecta un marcador al estilo [!NOTE] al inicio de una cita en bloque, lo registra como data-alert="note" y elimina el texto del marcador. El componente React blockquote luego renderiza un Alert de InstUI.

Devuelve

(tree) => void

Ejemplo

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

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