Skip to content

markdown-link-check

npm package providing CLI tool and libraries for checking links in Markdown files.

Exclusions

Ignore known problem links.

Disable next line:

<!-- markdown-link-check-disable-next-line -->

Disable current line:

<!-- markdown-link-check-disable-line -->

Disable block:

<!-- markdown-link-check-disable --> disables markdown link check. <!-- markdown-link-check-enable -->

Install

npm install -g markdown-link-check

Usage

$ markdown-link-check README.md 

FILE: README.md
  [✓] https://mike.bailey.net.au/notes
  [✓] https://github.com/mbailey/notes/blob/master/notes.sh
  [✓] docs/fast-learning.md
  [✓] https://www.youtube.com/embed/N5b4_5hvOog

  4 links checked.

Recursive:

find . -name \*.md -print0 | xargs -0 -n1 markdown-link-check

Bash function:

Check given directory (defaults to current)

markdown-link-check-dir ()  { 
    cd "${1:-.}";
    find . -name \*.md -print0 | xargs -0 -n1 markdown-link-check -q
}

Alias:

  • Only report on problems
  • Don't treat unauthenticated as a broken link
markdown-link-check -q --alive 200,403'

See also