From 8e79399f2cf87e6d8715b7daeb62ee39f3436a6b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Wed, 30 Aug 2023 16:02:19 +0200 Subject: [PATCH] allow block lists (again) --- markdown.awk | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/markdown.awk b/markdown.awk index eb40210..57a04e9 100755 --- a/markdown.awk +++ b/markdown.awk @@ -41,7 +41,7 @@ # - [x] Automatic
-wrapping (custom) # - ? Heading identifiers (php md, pandoc) # - [x] Heading attributes (custom) -# - [ ]
ends section +# - [ ]
terminates section # - [x] Automatic heading identifiers (custom) # - [x] Fenced code blocks (php md, pandoc) # - [x] Fenced code attributes @@ -741,10 +741,11 @@ function _block( block, LOCAL, st, len, text, title, attrib, href, guard, code, } } -function _list (block, mark, LOCAL, len, st, text, indent, task) { +function _list (block, mark, p, LOCAL, len, st, text, indent, task) { if ( match(block, "^([ \t]*\n)*$")) return; match(block, "^" mark "[ \t]"); indent = RLENGTH; sub("^" mark "[ \t]", "", block); + if (match(block, /\n[ \t]*\n/)) p = 1; match( block, "\n" mark "[ \t][^\n]+(\n|$)" \ "(([ \t]*\n)* ? ? ?" mark "[ \t][^\n]+(\n|$)" \ @@ -763,10 +764,10 @@ function _list (block, mark, LOCAL, len, st, text, indent, task) { sub(/^\[[-? /xX]\]/, "", text); text = _nblock( text ); - if (match( text, "^

(]|\n$" )) + if ( ! p && match( text, "^

(]|\n$" )) gsub( "(^

|

\n$)", "", text); - return task text "\n" _list(block, mark); + return task text "\n" _list(block, mark, p); } function _dlist (block, LOCAL, len, st, text, indent, p) { -- 2.39.2