remark-lint-no-dead-urls

raw JSON →
2.0.1 verified Fri May 01 auth: no javascript

A remark-lint rule that checks if URLs in Markdown files are alive by making HTTP requests, using the dead-or-alive library. Current stable version is 2.0.1 (February 2025), released under the unified collective with active maintenance. It differs from remark-validate-links by checking internet URLs rather than local file paths, and can also verify fragment IDs on web pages. ESM-only since v2, requires Node.js 18+.

error Error: Cannot find module 'remark-lint-no-dead-urls'
cause Package not installed or wrong import path.
fix
Run npm install remark-lint-no-dead-urls and ensure you are using import (ESM).
error TypeError: remarkLintNoDeadUrls is not a function
cause Using require() on an ESM-only package.
fix
Change const x = require('...') to import x from '...'.
error Error: The `from` option is required for relative URLs
cause Relative URLs are present but no from option or file.data.meta.origin/pathname set.
fix
Provide options.from or set file.data.meta.origin and pathname.
breaking v2 drops CommonJS support entirely; package is ESM only.
fix Use import instead of require().
breaking v2 requires Node.js 18 or later.
fix Update Node.js to version 18 or later.
breaking Option renamed from gotOptions to deadOrAliveOptions.
fix Replace gotOptions with deadOrAliveOptions in configuration.
deprecated The option prefixUrl is replaced with from.
fix Use options.from instead of options.gotOptions.prefixUrl.
gotcha If skipOffline is not set, the rule will throw an error when offline.
fix Set skipOffline: true in options to allow offline runs.
npm install remark-lint-no-dead-urls
yarn add remark-lint-no-dead-urls
pnpm add remark-lint-no-dead-urls

Shows how to use the rule in a unified pipeline: parse markdown, lint for dead URLs, stringify, and report.

import remarkLintNoDeadUrls from 'remark-lint-no-dead-urls';
import remarkLint from 'remark-lint';
import remarkParse from 'remark-parse';
import remarkStringify from 'remark-stringify';
import {read} from 'to-vfile';
import {unified} from 'unified';
import {reporter} from 'vfile-reporter';

const file = await read('example.md');

await unified()
  .use(remarkParse)
  .use(remarkLint)
  .use(remarkLintNoDeadUrls, {skipLocalhost: true})
  .use(remarkStringify)
  .process(file);

console.error(reporter(file));