From: Paul Hänsch Date: Thu, 1 Jul 2021 16:12:00 +0000 (+0200) Subject: md: horizontal rules X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=c1eb79536cd0c60151846c2c294581a029343e32;p=cgilite md: horizontal rules --- diff --git a/markdown.awk b/markdown.awk index a5c2eb1..eb35258 100755 --- a/markdown.awk +++ b/markdown.awk @@ -23,7 +23,7 @@ # - [x] Blockquotes # - [x] Lists (ordered, unordered) # - [x] Code blocks (using indention) -# - [ ] Horizontal rules +# - [x] Horizontal rules # # Basic Markdown - Inline elements: # --------------------------------- @@ -206,6 +206,11 @@ function _block( block, LOCAL, st, len, hlvl, htxt, guard, code, indent ) { if ( block == "" ) { return ""; + + # 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, /^> /) ) {