remark-lint-link-title-style

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

Unified.js remark-lint rule to enforce a consistent style of quote marks in link, image, and definition titles. Current stable version 4.0.1, ESM-only, TypeScript types included, part of the remark-lint ecosystem with regular updates and active maintenance. Differentiators: supports 'consistent' mode (auto-detect first style) and explicit settings for double quotes, single quotes, or parentheses; included in popular presets like remark-preset-lint-consistent.

error ERR_MODULE_NOT_FOUND: Cannot find module 'remark-lint-link-title-style'
cause Trying to require() an ESM-only package.
fix
Change to import statement or use dynamic import().
error The default export of 'remark-lint-link-title-style' is not a function
cause Using named import { remarkLintLinkTitleStyle } instead of default import.
fix
Use import remarkLintLinkTitleStyle from 'remark-lint-link-title-style'.
error Options is not a constructor
cause Trying to use Options as a value instead of a type.
fix
Remove the import or use import type { Options }.
breaking Version 4.0.0 dropped CommonJS support; package is now ESM-only.
fix Use dynamic import() or convert project to ESM. Use version 3.x for CJS support.
deprecated The 'consistent' option may produce different results across files if the first style varies; use explicit style for deterministic linting.
fix Set options to '"' or "'" explicitly.
gotcha When using TypeScript, import Options and Style as types only (import type) to avoid emitting runtime code.
fix Use import type { Options } from 'remark-lint-link-title-style'.
gotcha The rule only checks link title markers, not link text or URLs. Common mistake: assuming it validates all link syntax.
fix Use other remark-lint rules for link text (remark-lint-no-undefined-references) or URLs (remark-lint-no-url-trailing-slash).
gotcha In older Node.js versions (16+), the package may require ESM support. Not compatible with Node 14 or earlier.
fix Upgrade to Node 16+ or use version 3.x.
npm install remark-lint-link-title-style
yarn add remark-lint-link-title-style
pnpm add remark-lint-link-title-style

Set up a unified pipeline to lint markdown links for double-quote title style using remark-lint-link-title-style.

import { unified } from 'unified';
import remarkParse from 'remark-parse';
import remarkStringify from 'remark-stringify';
import remarkLint from 'remark-lint';
import remarkLintLinkTitleStyle from 'remark-lint-link-title-style';
import { read } from 'to-vfile';
import { reporter } from 'vfile-reporter';

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

await unified()
  .use(remarkParse)
  .use(remarkLint)
  .use(remarkLintLinkTitleStyle, '"')
  .use(remarkStringify)
  .process(file);

console.error(reporter(file));