Registry / testing / remark-lint-correct-media-syntax

remark-lint-correct-media-syntax

JSON →
library1.0.1jsnpmunverified

A remark-lint rule that warns when image or link syntax has brackets and parentheses accidentally swapped (e.g., `(text)[url]` instead of `[text](url)`). Current stable version is 1.0.1, ESM-only, requires Node.js 16+. It is a focused, zero-config lint rule with no parameters, part of the unified/remark ecosystem. Unlike broader lint presets, this rule targets a single common mistake with a clear, actionable message.

npm install remark-lint-correct-media-syntax
INSTALL
IMPORT
SIG · REMARK-LINT-CORREC
R
remark-lint-correct-media-syntax
testingjavascriptv1.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.

remarkLintCorrectMediaSyntax
✓ import remarkLintCorrectMediaSyntax from 'remark-lint-correct-media-syntax'
✗ const remarkLintCorrectMediaSyntax = require('remark-lint-correct-media-syntax')
This package is ESM-only and requires Node.js 16+. Using require() will throw an error.
default export
✓ import remarkLintCorrectMediaSyntax from 'remark-lint-correct-media-syntax'
✗ import { remarkLintCorrectMediaSyntax } from 'remark-lint-correct-media-syntax'
The package exports no named identifiers; the default export is the function.
TypeScript types
✓ import type { Transformer } from 'unified'
The package does not export custom types; you can use Transformer from unified if needed.

Shows how to use the plugin with unified to lint markdown for swapped bracket/paren syntax.

import { unified } from 'unified'; import remarkParse from 'remark-parse'; import remarkStringify from 'remark-stringify'; import remarkLint from 'remark-lint'; import remarkLintCorrectMediaSyntax from 'remark-lint-correct-media-syntax'; import { reporter } from 'vfile-reporter'; const file = await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintCorrectMediaSyntax) .use(remarkStringify) .process('(wrong)[https://example.com] and [correct](https://example.com)'); console.error(reporter(file));
Debug
Known issues
breakingPackage is ESM-only and does not support CommonJS require().
fix
Use import syntax instead of require(). Switch to ESM or use dynamic import() if needed.
affects: >=1.0.0
gotchaThe rule has no configuration options; it always checks for the specific pattern.
fix
No workaround; if you need to customize behavior, consider other lint rules or use remark-message-control.
affects: >=1.0.0
gotchaThe rule does not check for other media syntax issues like missing alt text or broken URLs.
fix
Use additional remark-lint plugins (e.g., remark-lint-no-literal-urls) for broader coverage.
affects: >=1.0.0
deprecatedNode.js 16 is the minimum required version; Node 14 is not supported.
fix
Upgrade Node.js to version 16 or later.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
Using CommonJS require() to load the ESM-only package.
fix
Change to import statement or use dynamic import().
Unexpected `)[`, expected `[` and `]` around the text (label) and `(` and `)` around the URL
Using `(text)[url]` instead of `[text](url)`.
fix
Swap the brackets and parentheses to `[text](url)`.
Cannot find module 'remark-lint-correct-media-syntax'
The package is not installed or the import path is incorrect.
fix
Run `npm install remark-lint-correct-media-syntax` and verify the import path.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
unifiedrequiredCore unified library required for processing
remark-lintrequiredRequired to use remark-lint plugins
remark-parseoptionalParser needed to process markdown
remark-stringifyoptionalSerializer needed for output
Agent activity
2 hits · last 30 days
node
2
Resources
remark-lint-correct-media-syntax — npm install remark-lint-correct-media-syntax · libregistry