callouts: map GitHub alert types caution and important
commit 8ef95cf289c647eb1b8cb7cdfb9c4fb07e7208d8 · parent 84ae9471ab
· browse this tree
Ximianth, 2026-08-09 12:25:05 UTC
caution folds onto warning (near-synonyms), important onto note. Without this they drop to a neutral box in docs authored against GFM.
diff --git a/README.md b/README.md index c0317c0..48c71ee 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,8 @@ The rendered box is `<div class="callout callout-{type}">` so docs authored for those tools render as intended). The styled types are `info`, `note`, `tip`, `success`, `todo`, `warning`, `danger`, and `reject`, each with its own accent color and icon; `info` and `note` ride the per-host accent. -`warn` is accepted as an alias for `warning`. +`warn` is accepted as an alias for `warning`, +and the GitHub alert types `caution` and `important` map onto `warning` and `note`. An unknown type still renders as a plain neutral box. Callouts do not nest, by design, diff --git a/callout.go b/callout.go index 9d65fba..54bd329 100644 --- a/callout.go +++ b/callout.go @@ -36,11 +36,12 @@ type calloutNode struct { var kindCallout = ast.NewNodeKind("Callout") -// calloutTypeAliases folds alternate type spellings onto the canonical set that -// style.css styles. Kept as a table because it is cheap to grow; for now it -// just spells warn out in full. +// calloutTypeAliases folds alternate spellings onto the canonical types that style.css styles: +// warn abbreviates warning; caution and important are GitHub alert types with no canonical of their own. var calloutTypeAliases = map[string]string{ - "warn": "warning", + "warn": "warning", + "caution": "warning", + "important": "note", } // canonicalCalloutType maps an author's type onto its canonical spelling,