README
ℹ️ Fork of tcort repository (version 3.8.3), with several improvements:
- completely rewritten in typescript
- see CHANGELOG.md since v3.8.3 to get full list of improvements (multiple inputs support, cache, concurrency, statistics, debug traces,...)
markdown-link-check
Extracts links from markdown texts and checks whether each link is
alive (200 OK) or dead.
mailto: links are validated with isemail.
Installation
To add the module to your project, run:
npm install --save-dev @boillodmanuel/markdown-link-check
To install the command line tool globally, run:
npm install -g @boillodmanuel/markdown-link-check
Usage
Using from Command line tool (CLI)
The command line tool checks markdown links from 1 or several files or URLs or from standard input.
Note: You can either use this library from a javascript/typescript project (as a node dependency) or from command line. To run the command line, type:
markdown-link-check README.mdif you installed it globallynpx markdown-link-check README.mdif you installed it as a project dependency.
Documentation
Usage: markdown-link-check [options] [filenameOrUrls...]
Argument:
[filenameOrUrls...]: one or several files or URLs. If absent, process stdin
Options:
Options specific to command line:
-c, --config [config]: apply a config file (JSON), holding e.g. url specific header configuration-q, --quiet: displays errors only-v, --verbose: displays detailed error information--print-summary: print total number of inputs and links process with details about link status (alive, ignored, dead, error)--print-cache-statsprints cache usage (hits and misses).--print-long-checksprints links that took more than given delay to verify. Default delay is5000, configure it with--long-checks-max-durationoption.--long-checks-max-durationconfigure delay for long check. Default is 5000.-h, --helpdisplay help for command
Options that override configuration file:
-a, --alive <codes>comma separated list of HTTP code to be considered as alive--retry-on-errorretry after the an error--retry-on-429retry after the duration indicated in 'retry-after' header when HTTP code is 429--timeout <duration>timeout in zeit/ms format. (e.g.2000ms,20s,1m). Default is10s.-e, --fileEncoding <encoding>set file enconding. Default isutf-8.-d, --debugdisplays debug traces (very verbose)
Examples
Simple examples:
# Check links from a markdown file hosted on the web
markdown-link-check https://github.com/tcort/markdown-link-check/blob/master/README.md
# Check links from a local markdown file
markdown-link-check ./README.md
# Check links from multiples markdown file
markdown-link-check ./README.md ./CHANGELOG.md
# Check links from stdin
curl -s https://github.com/tcort/markdown-link-check/blob/master/README.md | markdown-link-check
Advanced examples:
Check links for each files
# Check links from a local markdown folder (recursive)
find . -name \*.md -exec markdown-link-check {} \;
Check links for all files (run a single process which can leverage cache)
# Add files in a bash array (using -print0 to support file names with space or special characters)
FILES=()
while IFS= read -r -d