Skip to content

Commit 624609f

Browse files
committed
Added automatic link-checking and fixed plenty of links
1 parent ef57654 commit 624609f

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

hooks/pre-push

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
#!/bin/bash
2-
# Pre-push hook: build MkDocs locally and run LinkChecker
2+
# Pre-push hook: Custom linkchecker for local links, Build MkDocs locally and run LinkChecker on external links
3+
34
set -e
45

56
# === Paths ===
6-
PROJECT_ROOT="$(cd "$(dirname "$0")"/.. && pwd)"
7+
PROJECT_ROOT="$(git rev-parse --show-toplevel)"
78
VENV_BIN="$PROJECT_ROOT/venv/bin"
89
TMP_BUILD_DIR="$PROJECT_ROOT/.tmp-mkdocs-build"
910
DOCS_DIR="$PROJECT_ROOT/docs"
1011

12+
echo "PROJECT_ROOT=$PROJECT_ROOT"
13+
echo "DOCS_DIR=$DOCS_DIR"
14+
echo "VENV_BIN=$VENV_BIN"
15+
"$VENV_BIN/python" --version
16+
17+
# Activate venv if not already activated
18+
if [ -f "$VENV_BIN/activate" ]; then
19+
. "$VENV_BIN/activate"
20+
fi
21+
1122

1223
#Checking internal links in markdown files only
1324
echo "Checking internal links in markdown files..."
25+
1426
set +e
1527
#Using custom python script for internal link checking:
1628
"$VENV_BIN/python" "$PROJECT_ROOT/checklinks.py" "$DOCS_DIR"
1729
RESULT_INTERNAL=$?
30+
1831
set -e
1932

2033
if [ $RESULT_INTERNAL -ne 0 ]; then

0 commit comments

Comments
 (0)