From: Paul Hänsch Date: Sun, 25 Jul 2021 02:52:49 +0000 (+0200) Subject: Squashed 'cgilite/' changes from 52e7985..76395d4 X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;ds=sidebyside;h=0062e5835b9a5aa82e017c446a1bd54f1d9d7e2b;p=webtxt Squashed 'cgilite/' changes from 52e7985..76395d4 76395d4 Fix: prevent horizontal rule from masking 2nd order heading git-subtree-dir: cgilite git-subtree-split: 76395d4c218e3acbc460083c01049ad962cd8451 --- diff --git a/markdown.awk b/markdown.awk index 512be5d..361e600 100755 --- a/markdown.awk +++ b/markdown.awk @@ -274,11 +274,6 @@ function _block( block, LOCAL, st, len, hlvl, htxt, guard, code, indent ) { } else if ( AllowHTML && match( block, /^ ? ? ?(<\/[A-Za-z][A-Za-z0-9-]*[[:space:]]*>|<[A-Za-z][A-Za-z0-9-]*([[:space:]]+[A-Za-z_:][A-Za-z0-9_\.:-]*([[:space:]]*=[[:space:]]*([[:space:]"'=<>`]+|"[^"]*"|'[^']*'))?)*[[:space:]]*\/?>)([[:space:]]*\n)([^\n]|\n[ \t]*[^\n])*(\n[[:space:]]*\n|$)/) ) { len = RLENGTH; st = RSTART; return substr(block, st, len) _block(substr(block, st + len)); - - # Horizontal rule - } else if ( match( block, /(^|\n) ? ? ?((\* *){3,}|(- *){3,}|(_ *){3,})($|\n)/) ) { - len = RLENGTH; st = RSTART; - return _block(substr(block, 1, st - 1)) "
\n" _block(substr(block, st + len)); # Blockquote (leading >) } else if ( match( block, /^> /) ) { @@ -369,6 +364,11 @@ function _block( block, LOCAL, st, len, hlvl, htxt, guard, code, indent ) { return "" inline( htxt ) "\n\n" \ _block( substr( block, len + 1) ); + # Horizontal rule + } else if ( match( block, /(^|\n) ? ? ?((\* *){3,}|(- *){3,}|(_ *){3,})($|\n)/) ) { + len = RLENGTH; st = RSTART; + return _block(substr(block, 1, st - 1)) "
\n" _block(substr(block, st + len)); + # Plain paragraph } else { match( block, /(^|\n)[[:space:]]*(\n|$)/ ) || match( block, /$/ );