This commit is contained in:
Ben Grande 2023-10-30 09:31:16 +00:00
parent 9d3111f1fa
commit f733dbf75f
No known key found for this signature in database
GPG key ID: 00C64E14F51F9E56
220 changed files with 2520 additions and 7400 deletions

View file

@ -7,6 +7,24 @@
## Requires: https://github.com/mzlogin/vim-markdown-toc
set -eu
usage(){
echo "Usage: ${0##*/} <file> [file ...]"
exit 1
}
case "${1-}" in
""|-h|--?help) usage;;
esac
## vim-markdown-toc deletes lines if they are folded, can't rely on its native
## update on save.
if ! vim -e -c 'setf markdown' -c 'if !exists(":GenTocGFM") | cq | endif' -c q
then
echo "Error: Vim Plugin mzlogin/vim-markdown-toc is not installed."
exit 1
fi
for f in "$@"; do
if ! grep -q "^## Table of Contents$" "$f"; then
echo "Could not find table of contents on file: $f" >&2; exit 1