Registry / testing / remark-lint-media-style

remark-lint-media-style

JSON →
library1.0.1jsnpmunverified

Remark-lint rule to enforce consistent style for image and link URLs, either references (defined elsewhere) or resources (inline URLs). Current stable version is 1.0.1, part of the remark-lint monorepo. It supports three modes: 'consistent' (auto-detect first usage), 'reference', 'resource', and 'reference-reuse' (allow resources if used once). Only ESM, requires Node.js 16+. TypeScript types exported.

npm install remark-lint-media-style
INSTALL
IMPORT
SIG · REMARK-LINT-MEDIA-
R
remark-lint-media-style
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.

remarkLintMediaStyle
import remarkLintMediaStyle from 'remark-lint-media-style'
const remarkLintMediaStyle = require('remark-lint-media-style')
Package is ESM-only since v1. Default export.
Options
import type {Options} from 'remark-lint-media-style'
TypeScript type export.
Style
import type {Style} from 'remark-lint-media-style'
TypeScript type export.

Shows ESM usage with unified, remark-lint, and the media-style rule configured to prefer resource-style URLs.

import {unified} from 'unified'; import remarkParse from 'remark-parse'; import remarkStringify from 'remark-stringify'; import remarkLint from 'remark-lint'; import remarkLintMediaStyle from 'remark-lint-media-style'; import {read} from 'to-vfile'; import {reporter} from 'vfile-reporter'; const file = await read('example.md'); await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintMediaStyle, {style: 'resource'}) .use(remarkStringify) .process(file); console.error(reporter(file));
Debug
Known issues
gotchaThe 'consistent' option cannot detect 'reference-reuse' style; the first style used will be enforced.
fix
Manually set the style to 'reference-reuse' if that behavior is desired.
affects: >=1.0.0
breakingPackage is ESM-only and cannot be required() with CommonJS.
fix
Use dynamic import() or switch to ESM.
affects: >=1.0.0
deprecatedThis rule does not automatically detect reference reuse; 'reference-reuse' option was added explicitly.
fix
Use 'reference-reuse' instead of expecting automatic detection.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: remarkLintMediaStyle is not a function
Attempting to use require() or import incorrectly due to ESM-only.
fix
Use import remarkLintMediaStyle from 'remark-lint-media-style' in an ESM context.
SyntaxError: Unexpected token 'export'
Running CommonJS environment with ESM-only package.
fix
Set "type": "module" in package.json or use .mjs extension.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
unified-lint-rulerequiredCore rule engine for remark-lint plugins
remark-message-controloptionalProvides message control utilities
Agent activity
6 hits · last 30 days
node
6
Resources
remark-lint-media-style — npm install remark-lint-media-style · libregistry