You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This lint rule checks whether URLs are alive or not.
When should I use this?
You can use this lint rule to check that URLs are alive.
It’s similar to remark-validate-links,
but there’s an important difference.
That package checks the file system locally:
whether path/to/example.md exists.
But this package,
remark-lint-no-dead-urls,
checks the internet:
whether https://a.com is alive,
/docs/example is reachable on https://mydomain.com,
and even whether certain IDs exist on a web page.
This package uses dead-or-alive.
You can use it when you want to check URLs programmatically yourself.
Install
This package is ESM only.
In Node.js (version 18+),
install with npm:
deadOrAliveOptions (Options from dead-or-alive, optional)
— options passed to dead-or-alive;
deadOrAliveOptions.findUrls is always off
as further URLs are not applicable
from (string, optional, example: 'https://example.com/from')
— check relative values relative to this URL;
you can also define this by setting origin and pathname in
file.data.meta
skipLocalhost (boolean, default: false)
— whether to ignore localhost links such as https://localhost/*,
https://127.0.0.1/*;
shortcut for a skip pattern of
/^(https?:\/\/)(localhost|127\.0\.0\.1)(:\d+)?/
skipOffline (boolean, default: false)
— whether to let offline runs pass quietly
skipUrlPatterns (Array<RegExp | string>, optional)
— 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
unified().use(remarkLintNoDeadUrls[, options])
Warn when URLs are dead.
Notes
To improve performance,
decrease maxRetries in deadOrAliveOptions
and/or decrease the value used for
sleep in deadOrAliveOptions.
The normal behavior is to assume connections might be flakey and to sleep a
while and retry a couple times.
If you do not care whether anchors exist and don’t need to support HTML
redirects,
you can pass checkAnchor: false and followMetaHttpEquiv: false in
deadOrAliveOptions,
which enables a fast path without parsing HTML.
This projects is compatible with maintained versions of Node.js.
When we cut a new major release,
we drop support for unmaintained versions of Node.
This means we try to keep the current release line,
remark-lint-no-dead-urls@2,
compatible with Node.js 18.
Security
This package can typically be considered safe.
Note that this package checks URLs over the internet.
Don’t use this if you consider that’s dangerous.