Registry / testing / remark-lint-mdash-style

remark-lint-mdash-style

JSON →
library1.1.1jsnpmunverified

A remark-lint rule to enforce a consistent style for em dashes (mdash) in Markdown files. Version 1.1.1 is the current stable release, with no fixed release cadence. It offers three style options: '―' (Unicode em dash, default), '-' (single hyphen), and '--' (double hyphen). Unlike general-purpose linters, this package specifically targets mdash usage, a common typographic inconsistency. It is a lightweight plugin for the remark-lint ecosystem, primarily used in Node.js environments for CI or text processing pipelines. The package has no dependencies and is ESM-compatible but requires a CommonJS or ESM project that uses remark-lint.

npm install remark-lint-mdash-style
INSTALL
IMPORT
SIG · REMARK-LINT-MDASH-
R
remark-lint-mdash-style
testingjavascriptv1.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default export
import remarkLintMdashStyle from 'remark-lint-mdash-style'
const remarkLintMdashStyle = require('remark-lint-mdash-style')
The package is ESM-only since version 1.0.0; require() will throw an error. Use import or dynamic import.
plugin in unified pipeline
.use(remarkLintMdashStyle, { style: '--' })
.use(remarkLintMdashStyle, { 'remark-lint-mdash-style': '--' })
Options are passed directly to the plugin function, not nested under a key.
type import (TypeScript)
import type { Options } from 'remark-lint-mdash-style'
import { Options } from 'remark-lint-mdash-style'
The Options type is not exported as a value; use import type to avoid runtime errors.

Shows how to use remark-lint-mdash-style with remark-lint in an ESM environment, including configuration and processing of a Markdown string.

import { remark } from 'remark'; import remarkLint from 'remark-lint'; import remarkLintMdashStyle from 'remark-lint-mdash-style'; const result = await remark() .use(remarkLint) .use(remarkLintMdashStyle, { style: '--' }) .process('Some text - with hyphen instead of dash.'); if (result.messages.length > 0) { console.log(result.messages[0].reason); } else { console.log('No lint errors'); }
Debug
Known issues
breakingPackage is ESM-only; CommonJS require() fails
fix
Switch to import syntax or use dynamic import if in a CommonJS context.
affects: >=1.0.0
deprecatedOption style: '-' may be deprecated in future versions for clarity
fix
Consider using '--' or the Unicode em dash '—' instead, as single hyphen is ambiguous with bullet lists.
affects: >=1.0.0
gotchaOptions must be passed as an object, not as a string directly
fix
Use .use(plugin, { style: '--' }) instead of .use(plugin, '--').
affects: >=1.0.0
gotchaRule only checks text nodes; inline code blocks are excluded
fix
If you need to lint inline code, consider additional remark plugins.
affects: >=1.0.0
deprecatedThe default style '―' (Unicode em dash) may not be visible in all editors
fix
Explicitly set a style that matches your project's conventions, e.g., '--'.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'remark-lint-mdash-style'
Package not installed or not in node_modules
fix
Run 'npm install remark-lint-mdash-style' and ensure it is in dependencies.
Error [ERR_REQUIRE_ESM]: require() of ES Module ...
Trying to use require() for an ESM-only package
fix
Replace require() with import or use dynamic import: const plugin = (await import('remark-lint-mdash-style')).default;
TypeError: remarkLintMdashStyle is not a function
Importing the wrong symbol (default vs named) when using older bundlers
fix
Ensure you import the default export: import remarkLintMdashStyle from 'remark-lint-mdash-style'.
warning: Use `―` instead of `-` for mdash
The default style is the Unicode em dash, but the text contains a single hyphen
fix
Either change the text to use '—' or configure the rule with style: '--' or style: '-'.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-mdash-style — npm install remark-lint-mdash-style · libregistry