$ npm install remark-lint-no-dead-urls
remark-lint plugin to ensure that external URLs in your Markdown are alive.
Checks all of the following:
Checks [links](https://www.github.com).
Checks images: ![horse](/path/to/horse.jpg)
Checks definitions: see the [walrus].
[walrus]: /path/to/walrus.jpg
Uses check-links to check URLs for liveness.
A few details to keep in mind:
gotOptions.baseUrl
(see below).http:
and https:
.Use like any other remark-lint plugin. Check out the remark-lint documentation for details.
All options are optional. The options object may contain any of the following properties:
{boolean}
- Default: false
.
By default, if you are offline when you run the check you will receive a warning.
If you want to let offline runs quietly pass, set this option to true
.{boolean}
- Default: false
.
By default, localhost
links are treated the same as other links, so if your project is not running locally you'll receive a warning.
If you want to ignore localhost
links (e.g. http://localhost/*
, http://127.0.0.1/*
), set this option to true
.{Array}
- Array of String
| RegExp
.
A list of patterns for URLs that should be skipped. Each URL will be tested against each pattern, and will be ignored if new RegExp(pattern).test(url) === true
. For example, with skipUrls: [/^http:\/\/(.*)url-to-ignore\.com/, 'https://never-check.com']
, links with the URLs http://www.url-to-ignore.com/foo
and https://never-check.com/foo/bar
will not be checked.{Object}
- Passed through check-links to Got. See documentation for Got options. With these options, you can customize retry logic, specify custom headers, and more. Here are some specific Got options that you might want to use:
{string}
- Used as the base URL against which relative URLs are checked.
By default, relative URLs are ignored: you must provide this option to check them.
For example, with baseUrl: 'https://www.github.com'
, the relative URL /davidtheclark
is checked as https://www.github.com/davidtheclark
.{number}
- Maximum number of URLs to check concurrently (default 8
).When this rule is turned on, the following valid.md
is ok:
Here is a [good link](https://www.github.com/wooorm/remark)
When this rule is turned on, the following invalid.md
is not ok:
Here is a [bad link](https://www.github.com/wooom/remark-dead-link)
1:11-1:68: Link to https://www.github.com/wooom/remark-dead-link is dead
By default, relative links are ignored.
To check relative links, you must provide gotOptions.baseUrl
as an option.
When nothing is passed, the following valid.md
is ok:
Here is a [good relative link](wooorm/remark)
Here is a [bad relative link](wooorm/remark-dead-link)
When https://www.github.com
is passed in, the following valid.md
is ok:
Here is a [good relative link](wooorm/remark)
But the following invalid.md
is not ok:
Here is a [bad relative link](wooorm/remark-dead-link)
© 2010 - cnpmjs.org x YWFE | Home | YWFE