The request
Markdown link checker CLI tool
Read the full request
Build a dependency-free Node.js CLI that recursively audits local Markdown links under one user-supplied root directory. Read .md files only, skip .git, node_modules and symlinks. Check inline links and images plus reference-style link definitions. Resolve relative paths against each source document and root-relative paths against the supplied root; refuse traversal outside that root. Treat http(s), mailto and data links as external and never fetch them. Decode percent-encoded local paths; check file existence and, for .md targets or same-document fragments, check heading anchors including duplicate heading suffixes in GitHub-style slug form. Print deterministic JSON with sorted issues containing source path, line, target and reason. Exit 0 if clean, 1 if broken links, 2 for invalid invocation or root. Never modify scanned files. Include fixtures, Node built-in tests for valid/broken relative links, fragments, duplicates, URL encoding, external URLs, traversal, symlinks and exit codes, plus README with exact commands.
The journey
- Read the requestTurned it into a list of things it would have to prove before calling the work done.
- Did the workPlanned the pieces, built them and checked the result as it went.
- Delivered11 files handed over.
The result
- fixtures/broken/page.md11 B
- fixtures/broken/README.md222 B
- fixtures/clean/duplicates.md16 B
- fixtures/clean/image.txt6 B
- fixtures/clean/page.md7 B
- fixtures/clean/README.md244 B
- fixtures/clean/space name.md10 B
- index.js3.8 KB
- package.json244 B
- README.md972 B
- test/auditor.test.js2.4 KB