From 9c5e4d27995770085e28aec88491b0ebf07ccf7f Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Fri, 10 Jul 2026 11:32:00 -0600 Subject: [PATCH] script: add separate check for [url](url) in markdown --- scripts/link-format-chk.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/link-format-chk.sh b/scripts/link-format-chk.sh index 3b03edaf..90d052a8 100755 --- a/scripts/link-format-chk.sh +++ b/scripts/link-format-chk.sh @@ -36,4 +36,20 @@ while IFS= read -r fname; do done <<< "$GRES" fi done < <(find . -type f -name '*.md' | sort) + +REDUNDANT_ECODE=0 +while IFS= read -r fname; do + # Matches [url](url) + GRES=$(grep -nE '\[(https?://[^]]+)\]\(\1\)' "$fname") + if [ "$GRES" != "" ]; then + if [ $REDUNDANT_ECODE -eq 0 ]; then + >&2 echo "Markdown links where the text matches the URL are redundant. Use instead:" + fi + REDUNDANT_ECODE=1 + ECODE=1 + while IFS= read -r line; do + echo "- ${fname#./}:$line" + done <<< "$GRES" + fi +done < <(find . -type f -name '*.md' | sort) exit $ECODE