{"id":18738,"library":"remark-cli","title":"remark-cli","description":"Command-line interface for processing markdown with the remark ecosystem. Current stable version is 12.0.1, released as part of the remark monorepo. The CLI allows inspecting, linting, and transforming markdown files using over 150 plugins. It is the primary way to integrate remark into CI/CD pipelines or npm scripts. Key differentiators: full access to the unified ecosystem, supports configuration files (JSON, YAML, JS), and can output formatted syntax trees. Requires Node.js 16+. ESM-only package, does not support CommonJS require().","status":"active","version":"12.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/remarkjs/remark#main","tags":["javascript","bin","cli","markdown","mdast","remark","unified"],"install":[{"cmd":"npm install remark-cli","lang":"bash","label":"npm"},{"cmd":"yarn add remark-cli","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-cli","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Underlying argument parsing and file processing engine","package":"unified-args","optional":false},{"reason":"Default parser for markdown (from unified ecosystem unless overridden)","package":"remark-parse","optional":true},{"reason":"Default stringifier for markdown output (from unified ecosystem unless overridden)","package":"remark-stringify","optional":true}],"imports":[{"note":"Best used via npx or as a devDependency script. Global install not recommended.","wrong":"remark . --use remark-validate-links (without npx if not globally installed)","symbol":"remark-cli (binary)","correct":"npx remark . --use remark-validate-links"},{"note":"remark-cli is a CLI wrapper; use the 'remark' package for programmatic use.","wrong":"import remark from 'remark-cli'","symbol":"Programmatic API (run)","correct":"import { remark } from 'remark'"},{"note":"Since remark-cli 12.0.0, config files are ESM-only. Use export default.","wrong":"module.exports = { plugins: ['remark-preset-lint-consistent'] }","symbol":"Config file (remark.config.js or .remarkrc.js)","correct":"export default { plugins: ['remark-preset-lint-consistent'] }"}],"quickstart":{"code":"{\n  \"scripts\": {\n    \"lint:md\": \"remark . --frail --use remark-preset-lint-consistent --quiet\"\n  },\n  \"devDependencies\": {\n    \"remark-cli\": \"^12.0.1\",\n    \"remark-preset-lint-consistent\": \"^6.0.0\"\n  }\n}","lang":"javascript","description":"Configure a lint script for markdown files in package.json using remark-cli with a preset."},"warnings":[{"fix":"Update Node.js to 16+ and use import syntax in config files.","message":"ESM-only since version 12.0.0: require() is not supported. Use import or run via npx.","severity":"breaking","affected_versions":">=12.0.0"},{"fix":"Upgrade Node.js to version 16 or higher.","message":"Node.js 12 support dropped in v11.0.0 (and Node 14 dropped in v12.0.0). Current minimum is Node 16.","severity":"breaking","affected_versions":">=11.0.0"},{"fix":"Ensure you have a backup or use version control before running with --output.","message":"If using --output, the file is overwritten without confirmation. Always back up or use version control.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use only built-in reporters ('json', 'vfile-reporter-json') or verify plugin ESM compatibility.","message":"The --report option with custom reporters may not work with ESM-only plugins in newer versions.","severity":"deprecated","affected_versions":">=11.0.0"},{"fix":"Specify full extension for local plugins (e.g., --use ./plugin.mjs).","message":"Plugin resolution changed in v11.0.0 to match modern Node.js behavior. Relative paths like ./plugins/custom.mjs now require .mjs extension.","severity":"gotcha","affected_versions":">=11.0.0"},{"fix":"Review .remarkrc or .remarkignore files for YAML 1.2 compatibility (e.g., boolean values, octal numbers).","message":"YAML 1.2 compliance introduced in v11.0.0 may cause parsing differences in config files that relied on YAML 1.1 quirks.","severity":"breaking","affected_versions":">=11.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use import { remark } from 'remark' for programmatic use, or run CLI via npx or npm scripts.","cause":"Using require() to import remark-cli, which is ESM-only since v12.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/remark-cli/index.js from /path/to/project/script.js not supported."},{"fix":"Run npm install --save-dev remark-preset-lint-markdown-style-guide","cause":"The preset package is not installed or not in node_modules.","error":"Cannot find module 'remark-preset-lint-markdown-style-guide'"},{"fix":"Change module.exports to export default. Ensure package.json has type: module or use .mjs extension.","cause":"Using CommonJS module.exports in a .remarkrc.js config file; ESM syntax required.","error":"SyntaxError: Unexpected token 'export'"},{"fix":"Use --use ./local-plugin.mjs (or .js/.cjs with type: module) instead of just ./local-plugin.","cause":"Relative path to local plugin missing file extension; Node.js ESM resolution requires full extension.","error":"Error: Cannot find module './local-plugin'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}