fix: callout parsing (#469)

This commit is contained in:
hcplantern 2023-09-12 14:00:21 +08:00 committed by GitHub
parent 4e23e67244
commit a19df64be8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -69,6 +69,8 @@ const callouts = {
const calloutMapping: Record<string, keyof typeof callouts> = {
note: "note",
abstract: "abstract",
summary: "abstract",
tldr: "abstract",
info: "info",
todo: "todo",
tip: "tip",
@ -96,7 +98,7 @@ const calloutMapping: Record<string, keyof typeof callouts> = {
function canonicalizeCallout(calloutName: string): keyof typeof callouts {
let callout = calloutName.toLowerCase() as keyof typeof calloutMapping
return calloutMapping[callout] ?? calloutName
return calloutMapping[callout] ?? "note"
}
const capitalize = (s: string): string => {