1
0
mirror of https://github.com/bitcoin/bips.git synced 2026-07-13 17:56:00 +00:00

script: add separate check for [url](url) in markdown

This commit is contained in:
Jon Atack
2026-07-10 11:32:00 -06:00
parent 8268d40e58
commit 9c5e4d2799

View File

@@ -36,4 +36,20 @@ while IFS= read -r fname; do
done <<< "$GRES" done <<< "$GRES"
fi fi
done < <(find . -type f -name '*.md' | sort) 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 <URL> 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 exit $ECODE