From: Paul Hänsch Date: Wed, 5 Jul 2023 12:57:34 +0000 (+0200) Subject: min, max headline level arguments for toc macro X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=49c8b284b9a6a8cfbb6e65c0813c60d1d1f106f5;p=shellwiki min, max headline level arguments for toc macro --- diff --git a/macros/toc b/macros/toc index 0acec76..e68ac6f 100755 --- a/macros/toc +++ b/macros/toc @@ -12,8 +12,13 @@ else md() { cat; } fi +min="$1" max="$2" +[ "$min" -ge 1 -a "$min" -le 6 ] || min=1 +[ "$max" -ge "$min" ] || max="$min" +[ "$max" -le 6 ] || max=6 + md |sed -nE ' 1i '