Skip to content

pantoken-root / renderers/react-markdown/src / parseAlertMarker

ฟังก์ชัน: parseAlertMarker() ​

parseAlertMarker(text): { marker: AlertMarker; rest: string; } | undefined

เบต้า

ตรวจหาตัวบ่งชี้การแจ้งเตือนของ GitHub ที่อยู่ตอนต้นของข้อความ; ส่งกลับตัวบ่งชี้และข้อความที่เหลือ

พารามิเตอร์ ​

text ​

string

คืนค่า ​

{ marker: AlertMarker; rest: string; } | undefined

ตัวอย่าง ​

ts
import { parseAlertMarker } from "@pantoken/react-markdown";

parseAlertMarker("[!TIP] Helpful"); // { marker: "TIP", rest: "Helpful" }
parseAlertMarker("Plain text"); // undefined