-
Notifications
You must be signed in to change notification settings - Fork 459
USAGE
Your GitHub wiki has broken internal links. This validation system helps you find and fix them before committing.
cd /path/to/wiki
python3 scripts/validate-wiki-links.pyThis will show all broken links in your markdown files.
Common issue: Links include directory prefixes that shouldn't be there.
# β Wrong (includes directory in link name)
[Quick Start](Quick-Start)
[API Overview](API-Overview)
[FlowSpec](FlowSpec-Overview)
# β
Correct (just the file name)
[Quick Start](Quick-Start)
[API Overview](API-Overview)
[FlowSpec](FlowSpec-Overview)Why? GitHub wiki links use the file name only, not the directory path.
Option A: Auto-fix (recommended for bulk changes)
# Preview what will change
python3 scripts/fix-wiki-links.py --dry-run
# Apply the fixes
python3 scripts/fix-wiki-links.pyOption B: Manual fix Edit the markdown files based on the validator output.
python3 scripts/validate-wiki-links.pyShould show: β
All wiki links are valid!
git add .
git commit -m "Fix wiki links"The pre-commit hook will automatically validate before allowing the commit.
Your wiki has this structure:
wiki/
βββ API/
β βββ API-Commands.md
β βββ API-Overview.md
βββ Getting-Started/
β βββ Quick-Start.md
βββ Use-Cases/
βββ DDoS-Mitigation.md
Link to these files like this:
[API Commands](API-Commands) # β
Just the filename
[Quick Start](Quick-Start) # β
Just the filename
[DDoS Mitigation](DDoS-Mitigation) # β
Just the filenameNOT like this:
[API Commands](API-Commands) # β No paths
[Quick Start](Quick-Start) # β No directory prefix
[DDoS Mitigation](DDoS-Mitigation) # β No paths[API Overview](API-Overview) # β
No extension
[API Overview](API-Overview.md) # β Don't include .md# Header: "API Overview"
[Link](#api-overview) # β
Lowercase, spaces β hyphens
# Header: "Getting Started (v5)"
[Link](#getting-started-v5) # β
Parentheses removedThe pre-commit hook runs automatically when you git commit.
If it blocks your commit:
- Read the error message to see which links are broken
- Fix those links
- Try committing again
To bypass (not recommended):
git commit --no-verifyProblem: [Text](Page-Name) but Page-Name.md doesn't exist.
Solutions:
- Check actual file name:
find . -name "*Page*" - Remove directory prefixes from link
- Check for typos
Problem: [Text](Page#section) but Page.md doesn't have that header.
Solutions:
- Check exact header text in target file
- Remember GitHub converts to lowercase and replaces spaces
- This is a WARNING, not an ERROR (won't block commits)
Problem: Hook doesn't run on commit.
Solutions:
# Make hook executable
chmod +x .git/hooks/pre-commit
# Verify it exists
ls -la .git/hooks/pre-commit
# Test manually
.git/hooks/pre-commit_Sidebar.md:
- [Quick Start](Quick-Start) # β Wrong
- [API Overview](API-Overview) # β Wrong
- [FlowSpec](FlowSpec-Overview) # β Wrong_Sidebar.md:
- [Quick Start](Quick-Start) # β
Correct
- [API Overview](API-Overview) # β
Correct
- [FlowSpec](FlowSpec-Overview) # β
Correct- Run validator to see all errors:
python3 scripts/validate-wiki-links.py - Check
scripts/README.mdfor detailed documentation - File an issue on GitHub
Remember: GitHub wikis are flat - they don't use directory paths in links, only file names!
π Home
π Getting Started
π§ API
π‘οΈ Use Cases
π Address Families
βοΈ Configuration
π Operations
π Reference
- Architecture
- BGP State Machine
- Communities (RFC)
- Extended Communities
- BGP Ecosystem
- Capabilities (AFI/SAFI)
- RFC Support
π Migration
π Community
π External
- GitHub Repo β
- Slack β
- Issues β
π» Ghost written by Claude (Anthropic AI)