• Stars
    star
    420
  • Rank 103,194 (Top 3 %)
  • Language
    Haskell
  • License
    Other
  • Created almost 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Find broken links in text documents

brök

Find broken links in text documents

Demo

Similar idea to awesome_bot, but with different output options.

Currently only supports http:// and https:// prefixed URLs

Install

Binaries for Mac and Linux are available. Add the binary to a directory in your path (such as /usr/local/bin).

Docker

To build the latest version:

docker build -t brok https://github.com/smallhadroncollider/brok.git

To run brök:

docker run brok

Cabal

If you have cabal installed:

cabal install brok

Make sure you run cabal update if you haven't run it recently.

Building

Requirements: Stack

The following command will build brök and then install it in ~/.local/bin:

stack build && stack install

Usage

Basic Usage

Check all links in a single text file:

brok test.md

Or in multiple files:

brok test.md links.tex

If you're using this as part of a test suite, you probably only need the errors:

brok text.md links.tex > /dev/null

Options

Cache

By default brök will cache successes for a day in a .brokdb file. It will always recheck errors.

If you want to adjust the cache length, you can enter the number of seconds after which the cache invalidates:

# cache for a week
brok --cache 604800 test.md links.tex

If you want to avoid creating the .brokdb file or ignore the cache entirely you can use the --no-cache option:

# do not cache results
# and don't use previously generated cache
brok --no-cache test.md links.tex

Check Certificates

Most browsers will display a website even if it has certificate issues (such as an incomplete certificate chain). By default Brök will not check certificates, so replicate this behaviour.

If you would like to enforce certificate checking, you can turn this on:

brok --check-certs test.md

Any sites with certificate issues will then return a Could not connect error.

Ignore URLs

You can tell brök to ignore URLs with specified prefixes:

# ignore facebook and amazon URLS
brok --ignore "http://facebook.com" "http://amazon.com" test.md links.tex

Interval

By default brök waits for 100ms between URL checks. You can change the delay:

# wait for 1 second between checks
brok --interval 1000 test.md links.tex

Only Show Failures

If you want to see what's going on, but you're not interested in successes, then you can use the --only-failures option:

# see what's going on, but only show failures
brok --only-failures test.md links.tex

If you're using brök as part of a script then you should redirect stdout.

Colour Output

By default the output uses bash colour codes. You can turn this off using the --no-color setting.

Git Pre-Commit Hook

If you want to check all the links in your Git repo are valid before being able to commit then add something like the following to .git/hooks/pre-commit.

bash

#! /bin/bash

# cache for 1 week
# use find to check all *.md files
# only show errors (if there are any)
brok --cache 604800 $(find . -type f -name "*.md") > /dev/null

zsh

#! /bin/zsh

# cache for 1 week
# using a zsh glob to check all *.md files
# only show errors (if there are any)
brok --cache 604800 */**/*.md > /dev/null

More Repositories

1

taskell

Command-line Kanban board/task manager with support for Trello boards and GitHub projects
Haskell
1,610
star
2

cmt

Write consistent git commit messages based on a custom template
Haskell
186
star
3

ascii-runner

An infinite runner in your terminal
Haskell
102
star
4

taskell-2.0

taskell 2.0
Haskell
15
star
5

dotfiles

-.. --- - ..-. .. .-.. . ...
Vim Script
9
star
6

antigen-git-rebase

An Antigen/zsh script to help with rebasing
Shell
6
star
7

haskell-programming

Notes and exercises from Haskell Programming
Haskell
5
star
8

grunt-jspm

A grunt task for bundling JSPM
JavaScript
4
star
9

nand-to-tetris

Haskell implementation of Nand-to-Tetris
Haskell
4
star
10

binc

Keep your binaries in sync between computers
Swift
2
star
11

laravel-form-presenter

A Laravel package for easily generating and manipulating forms
PHP
2
star
12

fnump

A command line tool to batch bump file numbering
Haskell
2
star
13

rgb-hsl

A WebGL experiment to investigate how the RGB and HSL colour models related to one another
JavaScript
2
star
14

mavis

Mavis is a very simple jQuery plugin that takes an object of class/regex pairs. When applied to an `input` it will update the class when the regex value is matched.
JavaScript
1
star
15

watch

A Makefile watch script
Shell
1
star
16

talks--bristol-js--nov-16

Talk: Bristol JS, November 30th - Functional Programming
HTML
1
star
17

social-login

A social login adapter for non-client side code (e.g. APIs)
PHP
1
star
18

vagrant

Vagrantfile and Chef scripts for Nginx + PHP-FPM + Laravel
Ruby
1
star
19

kasdown

A utility for turning Markdown "scripts" into interactive web-pages
Haskell
1
star
20

binc-node

Binc helps sync your applications between Macs
JavaScript
1
star