A tool for verifying links in text-based files
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cmd
file
http
stat
text
verify
.gitignore
.travis.yml
Gopkg.lock
Gopkg.toml
LICENSE
README.adoc
cross-compile.sh
main.go
test.sh
third-party-licenses.sh

README.adoc

Link Verifier Build Status Go Report Card Codecov

A tool for verifying links in text-based files. Written in Go, available as executable.

Logo

Motivation

Ambitious tech writers use plain-text mark-up formats like AsciiDoc and Markdown for turning text into properly formatted blog posts, web pages and documentation. Incorporating URLs to refer to external resources is part of the process. Before publishing content it’s important to verify that linked URLs are valid and can be resolved. Nothing feels more unprofessional than broken links in a carefully crafted document.

Link verifier to the rescue! Automatically discover all mark-up files in a given directory and verify all links found in the documents before publishing them.

Installation

Prebuilt libraries

Prebuilt libraries for various platforms are available on GitHub. Just download, exact the archive and execute the binary.

Building from source

Building from source requires that you have Go installed on your machine.

go get -u -v github.com/bmuschko/link-verifier

Run the program with link-verifier from anywhere in the file system.

Command line options

Option Description Default Value

rootDirs

The comma-separated root directories used to recursively search for files.

Single directory content.

includePatterns

The comma-separated include patterns used to search for files. The value of the include patterns are always additive to the default file patterns.

Common AsciiDoc, Markdown and plain-test file extensions.

fail

Fails the program if at least one discovered link cannot be resolved.

true

timeout

The timeout in seconds used when calling the URL.

5

Example:

link-verifier -rootDirs data,content -includePatterns *.html,*.yml -fail false

Usage on CI

Integrating the tool with a build on CI is a breeze and can used as validation step before publishing mark-up files.

Travis CI

The following .travis.yml demonstrate the use of the prebuilt binary version on Linux 64 bit:

before_script:
  - wget https://github.com/bmuschko/link-verifier/releases/download/v0.1/link-verifier-0.1-linux64.tar.gz -O /tmp/link-verifier.tar.gz
  - tar -xvf /tmp/link-verifier.tar.gz
  - export PATH=$PATH:$PWD/link-verifier/

script:
  - ./link-verifier

Contribute!

It’s easy to contribute to this project. Install Go and the package manager Dep. Then run the following commands to get the source code, resolve external dependencies and build the project.

git clone https://github.com/bmuschko/link-verifier.git
cd link-verifier
dep ensure
go build