remark-lint-double-link

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

remark-lint rule to detect duplicate link URLs in Markdown files. Current stable version is 0.2.0, with sparse releases on-demand. Differentiates from other lint rules by focusing solely on duplicate URLs, not link text or other attributes. Provides both CLI and config integration via `.remarkrc`. Ships TypeScript declarations.

error TypeError: remarkLintDoubleLink is not a function
cause Using CommonJS require on an ESM-only package.
fix
Replace require with import statement.
error import { rule } from 'remark-lint-double-link' // returns undefined
cause Named import 'rule' might be the default export in older versions.
fix
Use default import: import remarkLintDoubleLink from 'remark-lint-double-link'
breaking ESM-only since v0.2.0, require() fails.
fix Use import syntax or upgrade bundler/Node to support ESM.
npm install remark-lint-double-link
yarn add remark-lint-double-link
pnpm add remark-lint-double-link

Shows how to use the remark plugin to lint a Markdown file for duplicate links.

import { read } from 'to-vfile';
import { remark } from 'remark';
import remarkLint from 'remark-lint';
import remarkLintDoubleLink from 'remark-lint-double-link';

const file = await remark()
  .use(remarkLint)
  .use(remarkLintDoubleLink)
  .process(await read('example.md'));

console.log(file.messages);