From 8268d40e58d4ca018f980b6f0ba7cdb49f9c3942 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Fri, 10 Jul 2026 11:25:25 -0600 Subject: [PATCH 1/3] script: don't raise on [url](url) in markdown grep --- scripts/link-format-chk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/link-format-chk.sh b/scripts/link-format-chk.sh index ecf8f73f09..3b03edafde 100755 --- a/scripts/link-format-chk.sh +++ b/scripts/link-format-chk.sh @@ -24,7 +24,7 @@ done < <(find . -type f -name '*.mediawiki' | sort) MARKDOWN_ECODE=0 while IFS= read -r fname; do - GRES=$(grep -nE '\[[[:space:]]*https?://[^][]*\]|\[\[(\.\./|/)?bip-[^][]*\]\]' "$fname") + GRES=$(grep -nE '\[[[:space:]]*https?://[^][[:space:]]+[[:space:]]+[^][]*\]|\[\[https?://[^][]*\]\]|\[\[(\.\./|/)?bip-[^][]*\]\]' "$fname") if [ "$GRES" != "" ]; then if [ $MARKDOWN_ECODE -eq 0 ]; then >&2 echo "Github Markdown format writes links as [text](URL), not as [URL text] or [[URL|text]]:" From 9c5e4d27995770085e28aec88491b0ebf07ccf7f Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Fri, 10 Jul 2026 11:32:00 -0600 Subject: [PATCH 2/3] 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 3b03edafde..90d052a87a 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 From aacb66802228579ecf86bbdba840cf4f06f50254 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Fri, 10 Jul 2026 11:35:24 -0600 Subject: [PATCH 3/3] script: editorial touchups in link-format-chk.sh --- scripts/link-format-chk.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/link-format-chk.sh b/scripts/link-format-chk.sh index 90d052a87a..8dcd5adfc0 100755 --- a/scripts/link-format-chk.sh +++ b/scripts/link-format-chk.sh @@ -4,7 +4,7 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # -# Check wrong mediawiki and markdown link formats +# Check mediawiki and markdown link formats ECODE=0 MEDIAWIKI_ECODE=0 @@ -12,7 +12,7 @@ while IFS= read -r fname; do GRES=$(grep -nE '\]\((https?://|\.\./bip-|/bip-)' "$fname") if [ "$GRES" != "" ]; then if [ $MEDIAWIKI_ECODE -eq 0 ]; then - >&2 echo "Github Mediawiki format writes links as [URL text], not as [text](URL):" + >&2 echo "GitHub Mediawiki format writes links as [URL text], not as [text](URL):" fi MEDIAWIKI_ECODE=1 ECODE=1 @@ -27,7 +27,7 @@ while IFS= read -r fname; do GRES=$(grep -nE '\[[[:space:]]*https?://[^][[:space:]]+[[:space:]]+[^][]*\]|\[\[https?://[^][]*\]\]|\[\[(\.\./|/)?bip-[^][]*\]\]' "$fname") if [ "$GRES" != "" ]; then if [ $MARKDOWN_ECODE -eq 0 ]; then - >&2 echo "Github Markdown format writes links as [text](URL), not as [URL text] or [[URL|text]]:" + >&2 echo "GitHub Markdown format writes links as [text](URL), not as [URL text] or [[URL|text]]:" fi MARKDOWN_ECODE=1 ECODE=1