From 92cc60ca8aa54bc345cc4070daf3aa2e08516b9b Mon Sep 17 00:00:00 2001 From: Jean-Michel Girard Date: Sun, 12 Mar 2023 08:38:14 -0400 Subject: [PATCH] Added support for markdown-link-check options --- hooks/mdlink-check.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/hooks/mdlink-check.sh b/hooks/mdlink-check.sh index f31073d4..703572fc 100755 --- a/hooks/mdlink-check.sh +++ b/hooks/mdlink-check.sh @@ -13,6 +13,16 @@ if ! command -v markdown-link-check; then exit 1 fi +# Parse arguments and separate files from markdown-link-check options +ARGS=() +FILES=() +while [[ $# -gt 0 ]]; do case "$1" in + -c | --config | -a | --alive | -r | --retry) ARGS+=("$1" "$2"); shift; ;; + -p | --progress | -q | --quiet | -v | --verbose) ARGS+=("$1"); ;; + *) FILES+=("$1"); ;; +esac; shift; done; + + # This is the recommended way to set the project root for properly resolving absolute paths. See # https://github.com/tcort/markdown-link-check/issues/16 for more info. # markdown-link-check 3.10 introduced checking anchors, which does not work witihn the same file. See @@ -34,6 +44,7 @@ cat > "$TMP_CONFIG" <