I'm looking for a link checker for HTML documents. Not for a website: for an HTML document, or a small collection of HTML documents. My constraints:

  • It must work on a collection of HTML files passed on the command line, without involving a web server.
  • It must be able to work without network access. Ideally it should have a command line option to indicate whether to check whether HTTP links are live.
  • It must check internal anchors and must support id attributes on any element. My primary use case is checking HTML files generated from Markdown by Pandoc or from reStructuredText by Sphinx.
  • It must work in a build-and-test automated pipeline, so no GUI or browser-based tools.
  • It must report the broken links in a usable way so I know what to fix if the validation fails.
  • It must work on Linux, macOS and Windows (Cygwin or WSL is ok).
  • It should be easy to set up even in an environment where we scrutinize all installed software for security. In particular I'd like to avoid a dependency on JavaScript ecosystems. Python would be preferred because that's our default scripting language, but I don't care what language the tool is written in, it's just to minimize extra dependencies. Ideally, the installation should only involve apt-get on Ubuntu or pip3 install.
  • It must be free for commercial use and preferably have a well-known open source license (so that there's no concern about installing it in a corporate environment — but I don't absolutely need to be able to redistribute it).
  • 1
    Did you have a look at W3D-LinkChecker (a.o. github.com/w3c/link-checker.git)?
    – albert
    Feb 12 '19 at 10:21
  • @albert Thanks, it looks promising. I'd skipped it because the Ubuntu package has a dependency on Apache, but I notice now that it's only a recommendation, and it does look like it can operate on local files. I'll give it a try. Feb 12 '19 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.