Markdown reader: `alert` class added in 3.12 breaks alert output in gfm, DocBook, AsciiDoc and RST writers

#11919 · closed · 1 comments

View on GitHub ↗

pan4ratte

**Pandoc version:** 3.12. Also present on `main` as of 2026-09-30. Since fa0dfdf0e (#11836), the Markdown reader puts `alert` first among the classes of an alert Div: ``` % pandoc -f markdown+alerts -t native > [!TIP] > A suggestion. ^D [ Div ( "" , [ "alert" , "tip" ] , [] ) [ Div ( "" , [ "title" ] , [] ) [ Para [ Str "Tip" ] ] , Para [ Str "A" , Space , Str "suggestion." ] ] ] ``` The writers that turn these Divs into alerts or admonitions look only at the *first* class, for example `(cls:_) <- classes` in `Writers/Markdown.hs` and `(l:_) | l `elem` admonitions` in the DocBook, AsciiDoc and RST writers. They now see `alert` and fall back to a plain Div: | `-t` | 3.11 | 3.12 | |---|---|---| | `gfm` | `> [!TIP]`<br>`> A suggestion.` | `<div class="alert tip">` with a nested `<div class="title">` | | `docbook` | `<tip><title>Tip</title><para>A suggestion.</para></tip>` | `<para>Tip</para><para>A suggestion.</para>` | | `asciidoc` | `[TIP]` / `====` block | `Tip` followed by `A suggestion.` as loose paragraphs | | `rst` | `.. tip::` | `.. container:: alert tip`, and the title is dropped | `gfm` → `gfm` is no longer a round trip for alerts read by the Markdown reader. The Org writer still writes `#+begin_tip`; it only adds `#+attr_html: :class alert`. The commonmark-based readers (`gfm`, `commonmark_x`) still produce `[ "tip" ]` without `alert`, so the two readers now give different ASTs for the same input. Possible fixes: - Emit `[ alert, "alert" ]` (type first) in the Markdown reader. This keeps every writer working and still gives CSS the `alert` class. - Or make the writers look for the type anywhere in the class list rather than only in the first position.

Comments

jgm

thanks!