docs(components): scaffold reference-docs folder + link checker

This commit is contained in:
Joseph Doherty
2026-06-03 15:24:05 -04:00
parent 5e106df9e6
commit 0da5d3dd0b
+20
View File
@@ -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"