Registry / testing / remark-lint-code-block-style

remark-lint-code-block-style

JSON →
library4.0.1jsnpmunverified

remark-lint rule to enforce a consistent code block style (indented or fenced) in Markdown. Version 4.0.1 is the current stable release. Part of the remark-lint ecosystem, it allows 'consistent' (auto-detect first style), 'indented', or 'fenced'. It is ESM-only since v4 and ships TypeScript definitions. Unlike other lint rules, this focuses solely on code block style, making it minimal and composable with other remark plugins. Frequently used in presets like remark-preset-lint-consistent.

npm install remark-lint-code-block-style
INSTALL
IMPORT
SIG · REMARK-LINT-CODE-B
R
remark-lint-code-block-style
testingjavascriptv4.0.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.

remarkLintCodeBlockStyle
✓ import remarkLintCodeBlockStyle from 'remark-lint-code-block-style'
✗ import { remarkLintCodeBlockStyle } from 'remark-lint-code-block-style'
Default export only. Named import is incorrect. ESM-only since v4.
Options
✓ import type { Options } from 'remark-lint-code-block-style'
✗ import { Options } from 'remark-lint-code-block-style' (type-only import preferred)
TypeScript type export, not runtime.
Style
✓ import type { Style } from 'remark-lint-code-block-style'
TypeScript type export for style values: 'indented' | 'fenced'.
CommonJS require
✓ const remarkLintCodeBlockStyle = require('remark-lint-code-block-style').default
✗ const { remarkLintCodeBlockStyle } = require('remark-lint-code-block-style')
ESM-only; CommonJS requires .default access. Not recommended.

Shows how to set up remark-lint with this rule to enforce fenced code blocks and report lint warnings.

import remarkLint from 'remark-lint' import remarkLintCodeBlockStyle from 'remark-lint-code-block-style' 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(remarkLintCodeBlockStyle, { style: 'fenced' }) .use(remarkStringify) .process(file) console.error(reporter(file))
Debug
Known issues
breakingSince v4, this package is ESM-only and no longer supports CommonJS require().
fix
Use import syntax or switch to dynamic import in CommonJS.
affects: >=4.0.0
deprecatedOptions via 'options.style' is now accepted as first argument; old pattern 'options.style' still works but deprecated.
fix
Pass style directly as string or object with 'style' key; e.g., .use(remarkLintCodeBlockStyle, 'fenced')
affects: <4.0.0
gotchaWhen using 'consistent' mode, the rule uses the first code block encountered as reference; mixing indented and fenced blocks in same file will warn after the first.
fix
Use explicit style like 'fenced' to avoid ambiguity.
affects: all
Errors
Common errors & fixes
SyntaxError: Named export 'remarkLintCodeBlockStyle' not found. The requested module 'remark-lint-code-block-style' is a CommonJS module, which may not support all module.exports as named exports.
Attempting named import instead of default import.
fix
Use `import remarkLintCodeBlockStyle from 'remark-lint-code-block-style'` (default import).
Error: Cannot find module 'remark-lint-code-block-style'
Package not installed or ESM module not resolved in CommonJS environment.
fix
Ensure package is installed: `npm install remark-lint-code-block-style`. If in CommonJS, use dynamic import: `const mod = await import('remark-lint-code-block-style')`.
TypeError: remarkLintCodeBlockStyle is not a function
Using `require('remark-lint-code-block-style')` without `.default` in ESM-only package.
fix
Use `const remarkLintCodeBlockStyle = require('remark-lint-code-block-style').default` in CommonJS, or switch to import.
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies
unifiedrequiredRequired to integrate as a remark plugin
remark-lintoptionalProvides the linting infrastructure (optional if used directly but recommended)
Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-code-block-style — npm install remark-lint-code-block-style · libregistry