From 01dadd76ff332d89503364a794423564f01805ea Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Thu, 18 May 2023 14:04:37 +0200 Subject: [PATCH] enable block element Macros --- markdown.awk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/markdown.awk b/markdown.awk index fa60543..b507266 100755 --- a/markdown.awk +++ b/markdown.awk @@ -608,6 +608,12 @@ function _block( block, LOCAL, st, len, hlvl, htxt, guard, code, indent, attrib return "

" HTML(substr(block, 1, len)) "

\n" _block( substr(block, len + 1) ); } + # Macros (standalone <> calls handled as block, so they are not wrapped in paragraph) + } else if ( AllowMacros && match( block, /^<<(([^>]|>[^>])+)>>(\n|$)/) ) { + len = RLENGTH; + text = gensub(/^<<(([^>]|>[^>])+)>>(\n.*)?$/, "\\1", 1, block); + return macro(text) _block(substr(block, len + 1)); + # Split paragraphs } else if ( match( block, /(^|\n)[[:space:]]*(\n|$)/) ) { len = RLENGTH; st = RSTART; -- 2.39.2