File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments