remark-lint-strikethrough-marker

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

remark-lint rule to enforce consistent GFM strikethrough markers (one tilde vs two). Current stable version is 3.0.1, ESM-only, requires Node.js 16+. Part of the remark-lint monorepo, ships TypeScript definitions. Unopinionated: default 'consistent' detects the first style and warns on deviations. Unlike general Markdown linting, this specifically targets the strikethrough marker count, a common source of inconsistency when using remark-gfm.

error TypeError: Cannot read properties of undefined (reading 'strikethrough')
cause remark-gfm not added before the lint rule
fix
Add .use(remarkGfm) before .use(remarkLintStrikethroughMarker).
error Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
cause Trying to require() an ESM-only package
fix
Use import syntax or set type: module in package.json.
error Module '"remark-lint-strikethrough-marker"' has no exported member 'remarkLintStrikethroughMarker'
cause Using named import instead of default import
fix
Use import remarkLintStrikethroughMarker from 'remark-lint-strikethrough-marker' (default import).
breaking ESM-only package: requires Node.js 16+ and cannot be used with CommonJS require()
fix Switch to ESM, use import syntax, or upgrade Node.js to 16+.
deprecated Plugin does not provide a preset; will not be auto-configured by remark-preset-lint-consistent or similar
fix Manually add the plugin to your remark-lint configuration.
gotcha Requires remark-gfm to be registered before remark-lint-strikethrough-marker, otherwise strikethrough syntax is not parsed
fix Ensure .use(remarkGfm) is called before the lint rule.
gotcha TypeScript types (Marker, Options) are only available via import type, not value imports
fix Use import type { Marker, Options } from 'remark-lint-strikethrough-marker'.
npm install remark-lint-strikethrough-marker
yarn add remark-lint-strikethrough-marker
pnpm add remark-lint-strikethrough-marker

Lint an MD file with remark-lint-strikethrough-marker enforcing two-tilde style, including GFM and reporter.

import { unified } from 'unified'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import remarkLint from 'remark-lint'
import remarkLintStrikethroughMarker from 'remark-lint-strikethrough-marker'
import remarkGfm from 'remark-gfm'
import { read } from 'to-vfile'
import { reporter } from 'vfile-reporter'

const file = await unified()
  .use(remarkParse)
  .use(remarkGfm)
  .use(remarkLint)
  .use(remarkLintStrikethroughMarker, '~~')
  .use(remarkStringify)
  .process(await read('example.md'))

console.error(reporter(file))