{"id":26239,"library":"remark-lint-media-style","title":"remark-lint-media-style","description":"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.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/remarkjs/remark-lint#main","tags":["javascript","image","link","lint","media","reference","remark","remark-lint","remark-lint-rule","typescript"],"install":[{"cmd":"npm install remark-lint-media-style","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-media-style","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-media-style","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core rule engine for remark-lint plugins","package":"unified-lint-rule","optional":false},{"reason":"Provides message control utilities","package":"remark-message-control","optional":true}],"imports":[{"note":"Package is ESM-only since v1. Default export.","wrong":"const remarkLintMediaStyle = require('remark-lint-media-style')","symbol":"remarkLintMediaStyle","correct":"import remarkLintMediaStyle from 'remark-lint-media-style'"},{"note":"TypeScript type export.","symbol":"Options","correct":"import type {Options} from 'remark-lint-media-style'"},{"note":"TypeScript type export.","symbol":"Style","correct":"import type {Style} from 'remark-lint-media-style'"}],"quickstart":{"code":"import {unified} from 'unified';\nimport remarkParse from 'remark-parse';\nimport remarkStringify from 'remark-stringify';\nimport remarkLint from 'remark-lint';\nimport remarkLintMediaStyle from 'remark-lint-media-style';\nimport {read} from 'to-vfile';\nimport {reporter} from 'vfile-reporter';\n\nconst file = await read('example.md');\nawait unified()\n  .use(remarkParse)\n  .use(remarkLint)\n  .use(remarkLintMediaStyle, {style: 'resource'})\n  .use(remarkStringify)\n  .process(file);\nconsole.error(reporter(file));","lang":"typescript","description":"Shows ESM usage with unified, remark-lint, and the media-style rule configured to prefer resource-style URLs."},"warnings":[{"fix":"Manually set the style to 'reference-reuse' if that behavior is desired.","message":"The 'consistent' option cannot detect 'reference-reuse' style; the first style used will be enforced.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use dynamic import() or switch to ESM.","message":"Package is ESM-only and cannot be required() with CommonJS.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use 'reference-reuse' instead of expecting automatic detection.","message":"This rule does not automatically detect reference reuse; 'reference-reuse' option was added explicitly.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use import remarkLintMediaStyle from 'remark-lint-media-style' in an ESM context.","cause":"Attempting to use require() or import incorrectly due to ESM-only.","error":"TypeError: remarkLintMediaStyle is not a function"},{"fix":"Set \"type\": \"module\" in package.json or use .mjs extension.","cause":"Running CommonJS environment with ESM-only package.","error":"SyntaxError: Unexpected token 'export'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}