npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

remark-lint-no-dead-urls

v1.1.0

Published

Ensure that URLs in your Markdown are alive

Downloads

23,470

Readme

remark-lint-no-dead-urls

remark-lint plugin to ensure that external URLs in your Markdown are alive.

NPM Build Status

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:

  • By default, relative URLs are skipped. To check relative URLs, set gotOptions.baseUrl (see below).
  • Ignores absolute URLs with protocols other than http: and https:.
  • check-links memoizes results, so on any given run each URL will only be pinged once; subsequent checks will be returned from the cache.

Usage

Use like any other remark-lint plugin. Check out the remark-lint documentation for details.

Options

All options are optional. The options object may contain any of the following properties:

  • skipOffline {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.
  • skipLocalhost {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.
  • skipUrlPatterns {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.
  • gotOptions {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:
    • gotOptions.baseUrl {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.
    • gotOptions.concurrency {number} - Maximum number of URLs to check concurrently (default 8).

Example

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)