Registry / testing / remark-lint-no-shortcut-reference-image

remark-lint-no-shortcut-reference-image

JSON →
library4.0.1jsnpmunverified

remark-lint rule to warn when shortcut reference images are used in Markdown. Shortcut references like ![text] look similar to plain text and can cause ambiguity; this rule enforces the use of collapsed or full reference images ([text][] or [text][reference]) to improve clarity. Current version is 4.0.1, part of the remark-lint monorepo. Releases follow semver; breaking changes may occur with major version bumps. This package is ESM-only, ships TypeScript types, and is recommended for consistent reference image syntax.

npm install remark-lint-no-shortcut-reference-image
INSTALL
IMPORT
SIG · REMARK-LINT-NO-SHO
R
remark-lint-no-shortcut-reference-image
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.

remarkLintNoShortcutReferenceImage
import remarkLintNoShortcutReferenceImage from 'remark-lint-no-shortcut-reference-image'
import { remarkLintNoShortcutReferenceImage } from 'remark-lint-no-shortcut-reference-image'
Default export; named exports are not available as of v4.
require
const remarkLintNoShortcutReferenceImage = require('remark-lint-no-shortcut-reference-image')
CommonJS require works in Node.js, but package is ESM-first. Use dynamic import or ESM for compatibility.
TypeScript types
import remarkLintNoShortcutReferenceImage from 'remark-lint-no-shortcut-reference-image'
import type { Options } from 'remark-lint-no-shortcut-reference-image'
Types are bundled but no Options type exists because the rule has no options. Import the default export to get types.

Lint a Markdown string for shortcut reference images using the unified ecosystem. The rule warns, does not modify.

import { unified } from 'unified'; import remarkParse from 'remark-parse'; import remarkStringify from 'remark-stringify'; import remarkLint from 'remark-lint'; import remarkLintNoShortcutReferenceImage from 'remark-lint-no-shortcut-reference-image'; import { reporter } from 'vfile-reporter'; const file = await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintNoShortcutReferenceImage) .use(remarkStringify) .process('![bad reference]\n\n[bad reference]: https://example.com/image.png'); console.log(reporter(file)); // Output: 1:1-1:16: Unexpected shortcut reference image (`![text]`), expected collapsed reference (`![text][]`)
Debug
Known issues
breakingThe package is ESM-only since version 4.0.0. You cannot use require() in CommonJS without dynamic import.
fix
Switch to ESM (import/export) or use dynamic import: const module = await import('remark-lint-no-shortcut-reference-image');
affects: >=4.0.0
breakingExport changed from named export to default export in version 4.0.0. Importing { remarkLintNoShortcutReferenceImage } will break.
fix
Use default import: import remarkLintNoShortcutReferenceImage from 'remark-lint-no-shortcut-reference-image';
affects: >=4.0.0
gotchaThe rule has no configuration options. Providing an options object will be silently ignored but may cause confusion.
fix
Do not pass options; simply use .use(remarkLintNoShortcutReferenceImage).
affects: *
deprecatedShortcut reference images are discouraged for accessibility reasons. This rule may be merged into a more general rule in the future.
fix
Follow recommendations to use collapsed or full references.
affects: >=3.0.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module
Using require() with an ESM-only package in a CommonJS context.
fix
Use import or dynamic import: const remarkLintNoShortcutReferenceImage = (await import('remark-lint-no-shortcut-reference-image')).default;
TypeError: remarkLintNoShortcutReferenceImage is not a function
Attempting to use the package as an object or calling it directly without the unified pipeline.
fix
Use the package as a unified plugin: .use(remarkLintNoShortcutReferenceImage).
Cannot find module 'remark-lint-no-shortcut-reference-image'
Package not installed or missing in package.json.
fix
Run npm install remark-lint-no-shortcut-reference-image.
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies
unifiedrequiredPeer dependency for integration with remark-lint
remark-lintrequiredRequired plugin registry for lint rules
remark-message-controloptionalUsed for message control in some setups
Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
2
Resources
remark-lint-no-shortcut-reference-image — npm install remark-lint-no-shortcut-reference-image · libregistry