Skip to content
Permalink
Browse files

Check broken links

  • Loading branch information...
richelbilderbeek committed Jun 8, 2019
1 parent 37446f0 commit e44447c6377c1d1b13924130abffbc21c906abc6
Showing with 30 additions and 0 deletions.
  1. +12 −0 .travis.yml
  2. +18 −0 check_dead_links
@@ -0,0 +1,12 @@
dist: xenial

install:
# Check dead links
- sudo apt-get install -qq npm
- npm config set strict-ssl false
- sudo npm install -g markdown-link-check

script:
# Check dead links
- rm .travis.yml
- ./check_dead_links
@@ -0,0 +1,18 @@
#!/bin/bash

# Collect all dead links in a file
find . -name \*.md -exec markdown-link-check {} \; 2>/dev/null | egrep "[✖]" > broken.txt

# Count the number of lines, extract only that number
n_broken=$(wc broken.txt --lines | cut -f 1 -d " ")

if [[ $n_broken > 0 ]]
then
echo "Number of broken files: "$n_broken
cat broken.txt
rm broken.txt
exit $n_broken
fi

rm broken.txt

0 comments on commit e44447c

Please sign in to comment.
You can’t perform that action at this time.