X-Git-Url: https://git.plutz.net/?p=cgilite;a=blobdiff_plain;f=markdown.awk;h=d28c7cfc760a2ed6c9fde6e040a2bf981c008b38;hp=b3166f9e6c8580b919b960df50229750a7a1e3c8;hb=b2b268b458208ba7746052e05f1f1f5ced081023;hpb=33cd660f68857ca73061593364524b441cfe5df1 diff --git a/markdown.awk b/markdown.awk index b3166f9..d28c7cf 100755 --- a/markdown.awk +++ b/markdown.awk @@ -390,6 +390,12 @@ function _block( block, LOCAL, st, len, hlvl, htxt, guard, code, indent, attrib return "" inline( htxt ) "\n\n" \ _block( substr( block, len + 1) ); + # Split paragraphs + } else if ( match( block, /(^|\n)[[:space:]]*(\n|$)/) ) { + len = RLENGTH; st = RSTART; + return _block( substr(block, 1, st - 1) ) "\n" \ + _block( substr(block, st + len) ); + # Horizontal rule } else if ( match( block, /(^|\n) ? ? ?((\* *){3,}|(- *){3,}|(_ *){3,})($|\n)/) ) { len = RLENGTH; st = RSTART; @@ -397,10 +403,7 @@ function _block( block, LOCAL, st, len, hlvl, htxt, guard, code, indent, attrib # Plain paragraph } else { - match( block, /(^|\n)[[:space:]]*(\n|$)/ ) || match( block, /$/ ); - len = RLENGTH; st = RSTART; - return "

" inline( substr(block, 1, st - 1) ) "

\n" \ - _block( substr(block, st + len) ); + return "

" inline(block) "

\n"; } }