Skip to content

pantoken / renderers/react-markdown/src / rehypeGithubAlerts

Συνάρτηση: rehypeGithubAlerts()

rehypeGithubAlerts(): (tree) => void

Βήτα

Ένα plugin rehype που επισημαίνει τα blockquotes ειδοποιήσεων του GitHub: ανιχνεύει έναν δείκτη στυλ [!NOTE] στην αρχή ενός blockquote, τον καταγράφει ως data-alert="note" και αφαιρεί το κείμενο του δείκτη. Το React blockquote component στη συνέχεια αποδίδει ένα InstUI Alert.

Επιστρέφει

(tree) => void

Παράδειγμα

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

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