Markdown reader: case-insensitive alert keywords (#11836)

The keywords (e.g. `TIP`) for GFM-style alerts need not be all caps.
This commit fixes that. It also adds the class `alert` to the produced
Divs to allow for namespacing.

This commit changes the emitted classes from the alert extension
of the basic Markdown reader to add the class `alert` to the
produced DIVs to allow for namespacing.
This commit is contained in:
Hendrik Erz
2026-08-30 02:25:41 +02:00
committed by GitHub
parent b913622e1f
commit fa0dfdf0e1
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -819,7 +819,7 @@ blockQuote = do
(do guardEnabled Ext_alerts
case raw of
(t:ts) | "[!" `T.isPrefixOf` t ->
case T.strip t of
case T.toUpper (T.strip t) of
"[!TIP]" -> pure (Just "tip", ts)
"[!WARNING]" -> pure (Just "warning", ts)
"[!IMPORTANT]" -> pure (Just "important", ts)
@@ -834,7 +834,7 @@ blockQuote = do
case mbAlert of
Nothing -> B.blockQuote <$> contents
Just alert ->
(B.divWith ("", [alert], [])
(B.divWith ("", ["alert", alert], [])
. (B.divWith ("", ["title"], []) (B.para (B.str (T.toTitle alert))) <>))
<$> contents
+1 -1
View File
@@ -4,7 +4,7 @@
> A suggestion.
^D
[ Div
( "" , [ "tip" ] , [] )
( "" , [ "alert" , "tip" ] , [] )
[ Div ( "" , [ "title" ] , [] ) [ Para [ Str "Tip" ] ]
, Para [ Str "A" , Space , Str "suggestion." ]
]