@@ -29,10 +29,9 @@ Command line interface to inspect and change markdown files with **[remark][]**.
29
29
30
30
This package is a command line interface (CLI) that you can use in your terminal
31
31
or in npm scripts and the like to inspect and change markdown files.
32
- This CLI is built around remark, which is a very popular ecosystem of plugins
33
- that work with markdown as structured data, specifically ASTs (abstract syntax
34
- trees).
35
- You can choose from the 150+ plugins that already exist or make your own.
32
+ This CLI is built around remark, which is an ecosystem of plugins that work with
33
+ markdown as structured data, specifically ASTs (abstract syntax trees).
34
+ You can choose from the 150+ existing plugins or make your own.
36
35
37
36
See [ the monorepo readme] [ remark ] for info on what the remark ecosystem is.
38
37
@@ -46,8 +45,8 @@ If not, you can always use [`remark`][remark-core] itself manually in a script.
46
45
47
46
## Install
48
47
49
- This package is [ ESM only] ( https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c ) .
50
- In Node.js (version 14.14+, or 16.0 +), install with [ npm] [ ] :
48
+ This package is [ ESM only] [ esm ] .
49
+ In Node.js (version 16 +), install with [ npm] [ ] :
51
50
52
51
``` sh
53
52
npm install remark-cli
@@ -58,7 +57,7 @@ npm install remark-cli
58
57
Add a table of contents with [ ` remark-toc ` ] [ remark-toc ] to ` readme.md ` :
59
58
60
59
``` sh
61
- remark readme.md --use remark-toc --output
60
+ remark readme.md --output -- use remark-toc
62
61
```
63
62
64
63
Lint all markdown files in the current directory according to the markdown style
@@ -80,31 +79,32 @@ Usage: remark [options] [path | glob ...]
80
79
81
80
Options:
82
81
82
+ --[no-]color specify color in report (on by default)
83
+ --[no-]config search for configuration files (on by default)
84
+ -e --ext <extensions> specify extensions
85
+ --file-path <path> specify path to process as
86
+ -f --frail exit with 1 on warnings
83
87
-h --help output usage information
84
- -v --version output version number
88
+ --[no-]ignore search for ignore files (on by default)
89
+ -i --ignore-path <path> specify ignore file
90
+ --ignore-path-resolve-from cwd|dir resolve patterns in `ignore-path` from its directory or cwd
91
+ --ignore-pattern <globs> specify ignore patterns
92
+ --inspect output formatted syntax tree
85
93
-o --output [path] specify output location
94
+ -q --quiet output only warnings and errors
86
95
-r --rc-path <path> specify configuration file
87
- -i --ignore-path <path > specify ignore file
96
+ --report <reporter > specify reporter
88
97
-s --setting <settings> specify settings
89
- -e --ext <extensions> specify extensions
90
- -u --use <plugins> use plugins
91
- -w --watch watch for changes and reprocess
92
- -q --quiet output only warnings and errors
93
98
-S --silent output only errors
94
- -f --frail exit with 1 on warnings
95
- -t --tree specify input and output as syntax tree
96
- --report <reporter> specify reporter
97
- --file-path <path> specify path to process as
98
- --ignore-path-resolve-from dir|cwd resolve patterns in `ignore-path` from its directory or cwd
99
- --ignore-pattern <globs> specify ignore patterns
100
99
--silently-ignore do not fail when given ignored files
100
+ --[no-]stdout specify writing to stdout (on by default)
101
+ -t --tree specify input and output as syntax tree
101
102
--tree-in specify input as syntax tree
102
103
--tree-out output syntax tree
103
- --inspect output formatted syntax tree
104
- --[no-]stdout specify writing to stdout (on by default)
105
- --[no-]color specify color in report (on by default)
106
- --[no-]config search for configuration files (on by default)
107
- --[no-]ignore search for ignore files (on by default)
104
+ -u --use <plugins> use plugins
105
+ --verbose report extra info for messages
106
+ -v --version output version number
107
+ -w --watch watch for changes and reprocess
108
108
109
109
Examples:
110
110
@@ -118,17 +118,17 @@ Examples:
118
118
$ remark . -o
119
119
```
120
120
121
- More information on all these options is available at
122
- [ ` unified-args ` ] [ unified-args ] , which does the work.
121
+ More info on all these options is available at [ ` unified-args ` ] [ unified-args ] ,
122
+ which does the work.
123
123
` remark-cli ` is ` unified-args ` preconfigured to:
124
124
125
- * Load ` remark- ` plugins
126
- * Search for markdown extensions
125
+ * load ` remark- ` plugins
126
+ * search for markdown extensions
127
127
([ ` .md ` , ` .markdown ` , etc] [ markdown-extensions ] )
128
- * Ignore paths found in [ ` .remarkignore ` files] [ ignore-file ]
129
- * Load configuration from
128
+ * ignore paths found in [ ` .remarkignore ` files] [ ignore-file ]
129
+ * load configuration from
130
130
[ ` .remarkrc ` , ` .remarkrc.js ` , etc files] [ config-file ]
131
- * Use configuration from
131
+ * use configuration from
132
132
[ ` remarkConfig ` fields in ` package.json ` files] [ config-file ]
133
133
134
134
## Examples
@@ -138,13 +138,13 @@ More information on all these options is available at
138
138
This example checks and formats markdown with ` remark-cli ` .
139
139
It assumes you’re in a Node.js package.
140
140
141
- First, install the CLI and plugins:
141
+ Install the CLI and plugins:
142
142
143
143
``` sh
144
- npm install remark-cli remark-toc remark- preset-lint-consistent remark-preset-lint-recommended --save-dev
144
+ npm install remark-cli remark-preset-lint-consistent remark-preset-lint-recommended remark-toc --save-dev
145
145
```
146
146
147
- Now, add an npm script in your ` package.json ` :
147
+ …then add an npm script in your ` package.json ` :
148
148
149
149
``` js
150
150
/* … */
@@ -158,7 +158,7 @@ Now, add an npm script in your `package.json`:
158
158
159
159
> 💡 ** Tip** : add ESLint and such in the ` format ` script too.
160
160
161
- Observe that the above change adds a ` format ` script, which can be run with
161
+ The above change adds a ` format ` script, which can be run with
162
162
` npm run format ` .
163
163
It runs remark on all markdown files (` . ` ) and rewrites them (` --output ` ).
164
164
Run ` ./node_modules/.bin/remark --help ` for more info on the CLI.
@@ -188,7 +188,7 @@ Then, add a `remarkConfig` to your `package.json` to configure remark:
188
188
```
189
189
190
190
> 👉 ** Note** : you must remove the comments in the above examples when
191
- > copy/pasting them, as comments are not supported in ` package.json ` files.
191
+ > copy/pasting them as comments are not supported in ` package.json ` files.
192
192
193
193
Finally, you can run the npm script to check and format markdown files in your
194
194
project:
@@ -269,20 +269,23 @@ Earlier wins (so in the above file structure `folder/.remarkrc.js` wins over
269
269
`folder/package.json`) :
270
270
271
271
1. `.remarkrc` (JSON)
272
- 2. `.remarkrc.json` (JSON)
273
272
3. `.remarkrc.cjs` (CJS)
274
- 4. `.remarkrc.mjs` (ESM)
275
273
5. `.remarkrc.js` (CJS or ESM, depending on `type : ' module' ` in ` package.json`)
274
+ 2. `.remarkrc.json` (JSON)
275
+ 4. `.remarkrc.mjs` (ESM)
276
276
6. `.remarkrc.yaml` (YAML)
277
277
7. `.remarkrc.yml` (YAML)
278
278
8. `package.json` with `remarkConfig` field
279
279
280
280
# # Compatibility
281
281
282
- Projects maintained by the unified collective are compatible with all maintained
282
+ Projects maintained by the unified collective are compatible with maintained
283
283
versions of Node.js.
284
- As of now, that is Node.js 14.14+, and 16.0+.
285
- Our projects sometimes work with older versions, but this is not guaranteed.
284
+
285
+ When we cut a new major release, we drop support for unmaintained versions of
286
+ Node.
287
+ This means we try to keep the current release line, `remark-cli@^11`,
288
+ compatible with Node.js 12.
286
289
287
290
# # Security
288
291
@@ -311,8 +314,6 @@ abide by its terms.
311
314
312
315
Support this effort and give back by sponsoring on [OpenCollective][collective]!
313
316
314
- <!--lint ignore no-html-->
315
-
316
317
<table>
317
318
<tr valign="middle">
318
319
<td width="20%" align="center" rowspan="2" colspan="2">
@@ -424,24 +425,26 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
424
425
425
426
[npm] : https://docs.npmjs.com/cli/install
426
427
427
- [xss] : https://en.wikipedia.org/wiki/Cross-site_scripting
428
+ [esm] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
429
+
430
+ [markdown-extensions] : https://github.com/sindresorhus/markdown-extensions
428
431
429
432
[rehype] : https://github.com/rehypejs/rehype
430
433
431
434
[rehype-sanitize] : https://github.com/rehypejs/rehype-sanitize
432
435
433
436
[remark] : https://github.com/remarkjs/remark
434
437
435
- [markdown-extensions] : https://github.com/sindresorhus/markdown-extensions
436
-
437
- [config-file] : https://github.com/unifiedjs/unified-engine/blob/main/doc/configure.md
438
+ [remark-core] : ../remark/
438
439
439
- [ignore-file ] : https://github.com/unifiedjs/unified-engine/blob/main/doc/ignore.md
440
+ [remark-toc ] : https://github.com/remarkjs/remark-toc
440
441
441
- [unified-args ] : https://github.com/unifiedjs/unified-args#cli
442
+ [config-file ] : https://github.com/unifiedjs/unified-engine#config-files
442
443
443
- [remark-core ] : ../remark
444
+ [ignore-file ] : https://github.com/unifiedjs/unified-engine#ignore-files
444
445
445
- [remark-toc ] : https://github.com/remarkjs/remark-toc
446
+ [unified-args ] : https://github.com/unifiedjs/unified-args#cli
446
447
447
448
[markdown-style-guide] : https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide
449
+
450
+ [xss] : https://en.wikipedia.org/wiki/Cross-site_scripting
0 commit comments