From 432414c236340e788c9a0d6166467d0cc2abcc55 Mon Sep 17 00:00:00 2001 From: Chirag Dhamange <64466827+Diamagnetic@users.noreply.github.com> Date: Sun, 12 Jul 2026 05:56:01 -0400 Subject: [PATCH] Fix: GFM empty task list conversion to ballot (#11744) Extend `taskListItemToAscii` to cover empty task lists. Closes #11599. --- src/Text/Pandoc/Shared.hs | 4 ++++ test/command/11712.md | 8 ++++++++ test/command/gfm.md | 12 ++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 test/command/11712.md diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 12e74b53b..21f07d5e7 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -681,6 +681,10 @@ taskListItemFromAscii = handleTaskListItem fromMd taskListItemToAscii :: Extensions -> [Block] -> [Block] taskListItemToAscii = handleTaskListItem toMd where + toMd [Str "☐"] = [rawMd "[ ]"] + toMd [Str "☒"] = [rawMd "[x]"] + toMd [Str "❏"] = [rawMd "[ ]"] + toMd [Str "✓"] = [rawMd "[x]"] toMd (Str "☐" : Space : is) = rawMd "[ ]" : Space : is toMd (Str "☒" : Space : is) = rawMd "[x]" : Space : is toMd (Str "❏" : Space : is) = rawMd "[ ]" : Space : is diff --git a/test/command/11712.md b/test/command/11712.md new file mode 100644 index 000000000..cd1ae971b --- /dev/null +++ b/test/command/11712.md @@ -0,0 +1,8 @@ +``` +% pandoc -f gfm -t gfm +- [ ] +- [ ] bubbles +^D +- [ ] +- [ ] bubbles +``` diff --git a/test/command/gfm.md b/test/command/gfm.md index 12bd09094..254788690 100644 --- a/test/command/gfm.md +++ b/test/command/gfm.md @@ -220,3 +220,15 @@ hi - [ ] foo - [x] bar ``` + +``` +% pandoc -f native -t gfm +[ BulletList + [ [ Plain [ Str "\9744" ] ] + , [ Plain [ Str "\9746" ] ] + ] +] +^D +- [ ] +- [x] +```