From 0da5d3dd0b932df79726eca98b35827dd3db87d9 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Wed, 3 Jun 2026 15:24:05 -0400 Subject: [PATCH] docs(components): scaffold reference-docs folder + link checker --- tools/check-doc-links.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 tools/check-doc-links.sh diff --git a/tools/check-doc-links.sh b/tools/check-doc-links.sh new file mode 100755 index 00000000..e3238be4 --- /dev/null +++ b/tools/check-doc-links.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# Check that all relative markdown links under docs/components resolve. +set -uo pipefail +cd "$(dirname "$0")/.." +for f in docs/components/*.md; do + [ -e "$f" ] || continue + # extract ](target) links, ignore http(s):, anchors, and mailto + grep -oE '\]\([^)]+\)' "$f" | sed -E 's/^\]\(//; s/\)$//' | while read -r link; do + case "$link" in + http://*|https://*|mailto:*|\#*) continue ;; + esac + target="${link%%#*}" # strip #anchor + [ -z "$target" ] && continue + resolved="$(cd "$(dirname "$f")" && cd "$(dirname "$target")" 2>/dev/null && pwd)/$(basename "$target")" + if [ ! -e "$resolved" ]; then + echo "BROKEN: $f -> $link" + fi + done +done +echo "link check done"