Skip to content

Commit c91f882

Browse files
GeiserXFERNS154
authored andcommitted
Fix CI link checker: properly exclude HTTP URLs and anchors
1 parent f79020b commit c91f882

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

.github/workflows/lint.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ jobs:
5555
- name: Check for broken internal links
5656
run: |
5757
echo "Checking internal markdown links..."
58-
FAIL=0
59-
# Extract markdown links and check if target files exist
58+
rm -f /tmp/link_fail
6059
for md in docs/*.md README.md; do
61-
grep -oP '\[.*?\]\(((?!http)[^)]+)\)' "$md" 2>/dev/null | \
62-
grep -oP '\(([^)]+)\)' | tr -d '()' | while read -r link; do
63-
# Handle anchors
60+
# Extract markdown links: [text](target)
61+
grep -oP '\]\([^)]+\)' "$md" 2>/dev/null | \
62+
grep -oP '\(([^)]+)\)' | tr -d '()' | \
63+
grep -v '^http' | grep -v '^#' | \
64+
while read -r link; do
6465
file=$(echo "$link" | cut -d'#' -f1)
6566
if [ -n "$file" ]; then
66-
# Resolve relative to the markdown file's directory
6767
dir=$(dirname "$md")
6868
target="${dir}/${file}"
6969
if [ ! -f "$target" ]; then

0 commit comments

Comments
 (0)