From: Paul Hänsch Date: Wed, 7 Jul 2021 12:10:24 +0000 (+0200) Subject: md: task lists X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=fa3afea3582cebca84678d4592ad739df6fd3e0d;p=cgilite md: task lists --- diff --git a/markdown.awk b/markdown.awk index 785ece8..24235f6 100755 --- a/markdown.awk +++ b/markdown.awk @@ -51,7 +51,7 @@ # - ? Grid table (pandoc) # - ? Pipe table (php md pandoc) # - [x] Line blocks (pandoc) -# - [ ] Task lists (pandoc) +# - [x] Task lists (pandoc) # - [ ] Definition lists (php md, pandoc) # - [-] Numbered example lists (pandoc) # - [-] Metadata blocks (pandoc) @@ -396,6 +396,12 @@ function _list( block, last, LOCAL, p) { sub( /<\/p>\n/, "", p ); } sub( /\n$/, "", p ); + + # Task List (pandoc) + if ( p ~ /^\[ \].*/ ) { p = "" substr(p, 4); } + else if ( p ~ /^\[[xX]\].*/ ) { p = "" substr(p, 4); } + else if ( p ~ /^

\[ \].*/ ) { p = "

" substr(p, 7); } + else if ( p ~ /^

\[[xX]\].*/ ) { p = "

" substr(p, 7); } return "

  • " p "
  • \n" _list( block, last ); }