Created
December 13, 2022 16:46
-
-
Save arbakker/a309317cde70c264e01fc65049f10348 to your computer and use it in GitHub Desktop.
Check broken links markdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# npm install --save-dev markdown-link-check -g | |
total=0 | |
broken=0 | |
rm -f broken-links.log | |
for file in $(find . -type f -name "*.md" | grep -v ".gitea") | |
do | |
file=$(realpath $file) | |
logging=$(markdown-link-check --verbose "$file" 2>&1) | |
if [[ $? -eq 1 ]] ;then | |
echo "$logging" >> broken-links.log | |
echo "BROKEN LINK(S) IN: ${file}" | |
broken=$((broken+1)) | |
fi | |
total=$((total+1)) | |
done | |
echo "broken links in ${broken}/${total} markdown files" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment