diff options
| -rw-r--r-- | lib/template.source.sh | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/template.source.sh b/lib/template.source.sh index a18e00f..29d0bf4 100644 --- a/lib/template.source.sh +++ b/lib/template.source.sh @@ -94,7 +94,15 @@ template::inline::index () { template::inline::toc () { echo '```' echo 'Table of contents:' - $GREP '^#' "$(basename "$CURRENT_TPL")" | $SED -E -n '/^#+ / { s/#/ /g; s/^ //; p; }' + < "$(basename "$CURRENT_TPL")" $SED -E -n ' + /^```/,/^```/! { + /^#+ / { + s/#/ /g + s/^ // + p + } + } + ' echo '```' } |
