Documentation Index
Fetch the complete documentation index at: https://mintlify.com/remarkjs/remark/llms.txt
Use this file to discover all available pages before exploring further.
remark-cli is a command-line interface built around remark that lets you inspect, lint, and reformat markdown files directly from your terminal or npm scripts. Under the hood it uses unified-args and comes pre-configured to load remark- prefixed plugins, recognise all common markdown file extensions, and discover configuration files automatically. You can reach for it whenever you want the full power of the remark plugin ecosystem without writing a custom Node.js script.
Install
--save-dev so the binary lands in node_modules/.bin and is available through npm scripts.
Basic usage
Full CLI reference
The complete help output fromremark --help:
Key flags
Output and plugins
Write processed output back to disk. When used without a value (e.g.
remark . -o) each file is rewritten in place. When a path is supplied, output goes to that file. Without this flag remark writes to stdout by default.Load and apply a plugin. The value is resolved the same way Node.js resolves modules — use the full npm package name (e.g.
--use remark-toc) or a relative path. Repeat the flag to apply multiple plugins.CI and verbosity
Exit with code
1 when warnings are emitted, in addition to errors. Without this flag, only hard errors produce a non-zero exit code.Suppress informational output; only warnings and errors are printed.
Suppress everything except errors. Warnings are hidden.
--verbose
Print extra diagnostic information alongside messages, such as the source plugin that produced each message.
Watch mode
Re-process files whenever they change on disk. Useful during authoring to get instant feedback. Press Ctrl+C to stop.
Syntax tree inspection
--inspect
Print the parsed markdown AST as formatted text instead of producing output. Handy for understanding how remark sees your document.
Treat both input and output as JSON-serialised syntax trees (MDAST). Equivalent to enabling both
--tree-in and --tree-out.--tree-in
Read input as a JSON-serialised syntax tree rather than raw markdown.
--tree-out
Write output as a JSON-serialised syntax tree rather than formatted markdown.
File selection
Override the set of file extensions remark processes. Accepts a comma-separated list (e.g.
--ext md,mdx). By default remark uses the full list of known markdown extensions from markdown-extensions.--ignore-pattern <globs>
Provide one or more glob patterns of files to skip. Patterns are resolved relative to the current working directory. Repeat the flag for multiple patterns.
Point to a custom ignore file instead of the default
.remarkignore discovery.--silently-ignore
Do not fail when a file that matches an ignore pattern is explicitly passed as an argument. Without this flag, passing an ignored file is treated as an error.
Configuration
Load a specific configuration file, bypassing the automatic config file search.
Pass settings to the remark processor inline (e.g.
--setting bullet:"*"). Settings are merged with any discovered config files.Default behaviours
Whenremark-cli starts up it applies the following defaults, all of which can be overridden with CLI flags:
- Plugin prefix — plugin names are resolved with the
remark-prefix, so--use tocis equivalent to--use remark-toc. - File extensions — all extensions from the
markdown-extensionspackage are recognised (.md,.markdown,.mkd,.mkdn,.mkdown,.ron, and more). - Ignore files —
.remarkignorefiles anywhere in the file system above a processed file are honoured automatically. - Config files —
.remarkrc,.remarkrc.js,.remarkrc.yml, and other supported formats are searched upwards from each processed file. TheremarkConfigfield inpackage.jsonis also recognised. See the Configuration page for details.