From 49c8b284b9a6a8cfbb6e65c0813c60d1d1f106f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Wed, 5 Jul 2023 14:57:34 +0200 Subject: [PATCH] min, max headline level arguments for toc macro --- macros/toc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 ' -- 2.39.2