Socket
Socket
Sign inDemoInstall

remark-cli

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-cli - npm Package Compare versions

Comparing version 11.0.0 to 12.0.0

57

cli.js
#!/usr/bin/env node
import {createRequire} from 'node:module'
/**
* @typedef Pack
* @property {string} name
* @property {string} version
* @property {string} description
*/
import fs from 'node:fs/promises'
import {resolve} from 'import-meta-resolve'
import markdownExtensions from 'markdown-extensions'
import {remark} from 'remark'
import {args} from 'unified-args'
import {remark} from 'remark'
const require = createRequire(import.meta.url)
/** @type {Pack} */
const proc = JSON.parse(
String(
await fs.readFile(
new URL('package.json', resolve('remark', import.meta.url))
)
)
)
const proc = require('remark/package.json')
const cli = require('./package.json')
/** @type {Pack} */
const cli = JSON.parse(
String(await fs.readFile(new URL('package.json', import.meta.url)))
)
// To do: enable `markdown-extensions` once it supports ESM.
const extensions = [
'md',
'markdown',
'mdown',
'mkdn',
'mkd',
'mdwn',
'mkdown',
'ron'
]
args({
description: cli.description,
extensions: markdownExtensions,
ignoreName: '.' + proc.name + 'ignore',
name: proc.name,
packageField: proc.name + 'Config',
pluginPrefix: proc.name,
processor: remark,
name: proc.name,
description: cli.description,
rcName: '.' + proc.name + 'rc',
version: [
proc.name + ': ' + proc.version,
cli.name + ': ' + cli.version
].join(', '),
pluginPrefix: proc.name,
packageField: proc.name + 'Config',
rcName: '.' + proc.name + 'rc',
ignoreName: '.' + proc.name + 'ignore',
extensions
].join(', ')
})
{
"name": "remark-cli",
"version": "11.0.0",
"description": "Command line interface to inspect and change markdown files with remark",
"version": "12.0.0",
"description": "CLI to process markdown with remark",
"license": "MIT",
"keywords": [
"unified",
"remark",
"bin",
"cli",
"markdown",
"mdast",
"cli",
"bin"
"remark",
"unified"
],

@@ -26,3 +26,3 @@ "homepage": "https://remark.js.org",

"type": "module",
"main": "index.js",
"exports": [],
"bin": {

@@ -35,16 +35,17 @@ "remark": "cli.js"

"dependencies": {
"remark": "^14.0.0",
"unified-args": "^10.0.0"
"import-meta-resolve": "^3.0.0",
"markdown-extensions": "^2.0.0",
"remark": "^15.0.0",
"unified-args": "^11.0.0"
},
"scripts": {
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
"test": "node --conditions development test.js"
},
"xo": false,
"scripts": {},
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true,
"ignoreCatch": true
"ignoreCatch": true,
"strict": true
},
"xo": {
"prettier": true
}
}

@@ -32,6 +32,5 @@ # remark-cli

or in npm scripts and the like to inspect and change markdown files.
This CLI is built around remark, which is a very popular ecosystem of plugins
that work with markdown as structured data, specifically ASTs (abstract syntax
trees).
You can choose from the 150+ plugins that already exist or make your own.
This CLI is built around remark, which is an ecosystem of plugins that work with
markdown as structured data, specifically ASTs (abstract syntax trees).
You can choose from the 150+ existing plugins or make your own.

@@ -50,4 +49,4 @@ See [the monorepo readme][remark] for info on what the remark ecosystem is.

This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
In Node.js (version 14.14+, or 16.0+), install with [npm][]:
This package is [ESM only][esm].
In Node.js (version 16+), install with [npm][]:

@@ -63,3 +62,3 @@ ```sh

```sh
remark readme.md --use remark-toc --output
remark readme.md --output --use remark-toc
```

@@ -86,27 +85,28 @@

--[no-]color specify color in report (on by default)
--[no-]config search for configuration files (on by default)
-e --ext <extensions> specify extensions
--file-path <path> specify path to process as
-f --frail exit with 1 on warnings
-h --help output usage information
-v --version output version number
--[no-]ignore search for ignore files (on by default)
-i --ignore-path <path> specify ignore file
--ignore-path-resolve-from cwd|dir resolve patterns in `ignore-path` from its directory or cwd
--ignore-pattern <globs> specify ignore patterns
--inspect output formatted syntax tree
-o --output [path] specify output location
-q --quiet output only warnings and errors
-r --rc-path <path> specify configuration file
-i --ignore-path <path> specify ignore file
--report <reporter> specify reporter
-s --setting <settings> specify settings
-e --ext <extensions> specify extensions
-u --use <plugins> use plugins
-w --watch watch for changes and reprocess
-q --quiet output only warnings and errors
-S --silent output only errors
-f --frail exit with 1 on warnings
--silently-ignore do not fail when given ignored files
--[no-]stdout specify writing to stdout (on by default)
-t --tree specify input and output as syntax tree
--report <reporter> specify reporter
--file-path <path> specify path to process as
--ignore-path-resolve-from dir|cwd resolve patterns in `ignore-path` from its directory or cwd
--ignore-pattern <globs> specify ignore patterns
--silently-ignore do not fail when given ignored files
--tree-in specify input as syntax tree
--tree-out output syntax tree
--inspect output formatted syntax tree
--[no-]stdout specify writing to stdout (on by default)
--[no-]color specify color in report (on by default)
--[no-]config search for configuration files (on by default)
--[no-]ignore search for ignore files (on by default)
-u --use <plugins> use plugins
--verbose report extra info for messages
-v --version output version number
-w --watch watch for changes and reprocess

@@ -125,13 +125,13 @@ Examples:

More information on all these options is available at
[`unified-args`][unified-args], which does the work.
More info on all these options is available at [`unified-args`][unified-args],
which does the work.
`remark-cli` is `unified-args` preconfigured to:
* Load `remark-` plugins
* Search for markdown extensions
* load `remark-` plugins
* search for markdown extensions
([`.md`, `.markdown`, etc][markdown-extensions])
* Ignore paths found in [`.remarkignore` files][ignore-file]
* Load configuration from
* ignore paths found in [`.remarkignore` files][ignore-file]
* load configuration from
[`.remarkrc`, `.remarkrc.js`, etc files][config-file]
* Use configuration from
* use configuration from
[`remarkConfig` fields in `package.json` files][config-file]

@@ -146,9 +146,9 @@

First, install the CLI and plugins:
Install the CLI and plugins:
```sh
npm install remark-cli remark-toc remark-preset-lint-consistent remark-preset-lint-recommended --save-dev
npm install remark-cli remark-preset-lint-consistent remark-preset-lint-recommended remark-toc --save-dev
```
Now, add an npm script in your `package.json`:
…then add an npm script in your `package.json`:

@@ -167,3 +167,3 @@ ```js

Observe that the above change adds a `format` script, which can be run with
The above change adds a `format` script, which can be run with
`npm run format`.

@@ -198,3 +198,3 @@ It runs remark on all markdown files (`.`) and rewrites them (`--output`).

> 👉 **Note**: you must remove the comments in the above examples when
> copy/pasting them, as comments are not supported in `package.json` files.
> copy/pasting them as comments are not supported in `package.json` files.

@@ -280,6 +280,6 @@ Finally, you can run the npm script to check and format markdown files in your

1. `.remarkrc` (JSON)
3. `.remarkrc.cjs` (CJS)
5. `.remarkrc.js` (CJS or ESM, depending on `type: 'module'` in `package.json`)
2. `.remarkrc.json` (JSON)
3. `.remarkrc.cjs` (CJS)
4. `.remarkrc.mjs` (ESM)
5. `.remarkrc.js` (CJS or ESM, depending on `type: 'module'` in `package.json`)
6. `.remarkrc.yaml` (YAML)

@@ -291,7 +291,10 @@ 7. `.remarkrc.yml` (YAML)

Projects maintained by the unified collective are compatible with all maintained
Projects maintained by the unified collective are compatible with maintained
versions of Node.js.
As of now, that is Node.js 14.14+, and 16.0+.
Our projects sometimes work with older versions, but this is not guaranteed.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line, `remark-cli@^12`,
compatible with Node.js 16.
## Security

@@ -324,4 +327,2 @@

<!--lint ignore no-html-->
<table>

@@ -375,2 +376,6 @@ <tr valign="middle">

<td width="10%" align="center">
<a href="https://markdown.space">Markdown Space</a><br><br>
<a href="https://markdown.space"><img src="https://images.opencollective.com/markdown-space/e1038ed/logo/128.png" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://www.holloway.com">Holloway</a><br><br>

@@ -381,3 +386,2 @@ <a href="https://www.holloway.com"><img src="https://avatars1.githubusercontent.com/u/35904294?s=128&v=4" width="64"></a>

<td width="10%"></td>
<td width="10%"></td>
</tr>

@@ -437,4 +441,6 @@ <tr valign="middle">

[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[markdown-extensions]: https://github.com/sindresorhus/markdown-extensions
[rehype]: https://github.com/rehypejs/rehype

@@ -446,14 +452,14 @@

[markdown-extensions]: https://github.com/sindresorhus/markdown-extensions
[remark-core]: ../remark/
[config-file]: https://github.com/unifiedjs/unified-engine/blob/main/doc/configure.md
[remark-toc]: https://github.com/remarkjs/remark-toc
[ignore-file]: https://github.com/unifiedjs/unified-engine/blob/main/doc/ignore.md
[config-file]: https://github.com/unifiedjs/unified-engine#config-files
[ignore-file]: https://github.com/unifiedjs/unified-engine#ignore-files
[unified-args]: https://github.com/unifiedjs/unified-args#cli
[remark-core]: ../remark
[markdown-style-guide]: https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide
[remark-toc]: https://github.com/remarkjs/remark-toc
[markdown-style-guide]: https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc