Skip to content

Commit 3d499b3

Browse files
watildegibfahn
authored andcommitted
tools: introduce remark-cli@3.0.1
PR-URL: #12756 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
1 parent 04fac61 commit 3d499b3

File tree

3 files changed

+177
-0
lines changed

3 files changed

+177
-0
lines changed

tools/remark-cli/cli.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env node
2+
/**
3+
* @author Titus Wormer
4+
* @copyright 2015 Titus Wormer
5+
* @license MIT
6+
* @module remark:cli
7+
* @fileoverview CLI to process markdown.
8+
*/
9+
10+
'use strict';
11+
12+
/* Dependencies. */
13+
var start = require('unified-args');
14+
var extensions = require('markdown-extensions');
15+
var processor = require('remark');
16+
var proc = require('remark/package.json');
17+
var cli = require('./package.json');
18+
19+
/* Start. */
20+
start({
21+
processor: processor,
22+
name: proc.name,
23+
description: cli.description,
24+
version: [
25+
proc.name + ': ' + proc.version,
26+
cli.name + ': ' + cli.version
27+
].join(', '),
28+
pluginPrefix: proc.name,
29+
presetPrefix: proc.name + '-preset',
30+
packageField: proc.name + 'Config',
31+
rcName: '.' + proc.name + 'rc',
32+
ignoreName: '.' + proc.name + 'ignore',
33+
extensions: extensions
34+
});

tools/remark-cli/package.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "remark-cli",
3+
"version": "3.0.1",
4+
"description": "CLI to process markdown with remark using plugins",
5+
"license": "MIT",
6+
"keywords": [
7+
"markdown",
8+
"remark",
9+
"cli",
10+
"bin"
11+
],
12+
"dependencies": {
13+
"markdown-extensions": "^1.1.0",
14+
"remark": "^7.0.0",
15+
"unified-args": "^3.0.0"
16+
},
17+
"homepage": "http://remark.js.org",
18+
"repository": "https://github.com/wooorm/remark/tree/master/packages/remark-cli",
19+
"bugs": "https://github.com/wooorm/remark/issues",
20+
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
21+
"contributors": [
22+
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)"
23+
],
24+
"bin": {
25+
"remark": "cli.js"
26+
},
27+
"files": [
28+
"cli.js"
29+
],
30+
"scripts": {},
31+
"xo": false
32+
}

tools/remark-cli/readme.md

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# remark-cli [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat]
2+
3+
Command-line interface for [**remark**][remark].
4+
5+
* Loads [`remark-` plugins][plugins]
6+
* Searches for [markdown extensions][markdown-extensions]
7+
* Ignores paths found in [`.remarkignore` files][ignore-file]
8+
* Loads configuration from [`.remarkrc`, `.remarkrc.js` files][config-file]
9+
* Uses configuration from [`remarkConfig` fields in `package.json`
10+
files][config-file]
11+
12+
## Installation
13+
14+
[npm][]:
15+
16+
```sh
17+
npm install remark-cli
18+
```
19+
20+
## Usage
21+
22+
```sh
23+
# Add a table of contents to `readme.md`
24+
$ remark readme.md --use toc --output
25+
26+
# Lint markdown files in the current directory
27+
# according to the markdown style guide.
28+
$ remark . --use preset-lint-markdown-style-guide
29+
```
30+
31+
## CLI
32+
33+
See [**unified-args**][unified-args], which provides the interface,
34+
for more information on all available options.
35+
36+
```txt
37+
Usage: remark [options] [path | glob ...]
38+
39+
CLI to process markdown with remark using plugins
40+
41+
Options:
42+
43+
-h --help output usage information
44+
-v --version output version number
45+
-o --output [path] specify output location
46+
-r --rc-path <path> specify configuration file
47+
-i --ignore-path <path> specify ignore file
48+
-s --setting <settings> specify settings
49+
-e --ext <extensions> specify extensions
50+
-u --use <plugins> use plugins
51+
-p --preset <presets> use presets
52+
-w --watch watch for changes and reprocess
53+
-q --quiet output only warnings and errors
54+
-S --silent output only errors
55+
-f --frail exit with 1 on warnings
56+
-t --tree specify input and output as syntax tree
57+
--file-path <path> specify path to process as
58+
--tree-in specify input as syntax tree
59+
--tree-out output syntax tree
60+
--[no-]stdout specify writing to stdout (on by default)
61+
--[no-]color specify color in report (on by default)
62+
--[no-]config search for configuration files (on by default)
63+
--[no-]ignore search for ignore files (on by default)
64+
65+
Examples:
66+
67+
# Process `input.md`
68+
$ remark input.md -o output.md
69+
70+
# Pipe
71+
$ remark < input.md > output.md
72+
73+
# Rewrite all applicable files
74+
$ remark . -o
75+
```
76+
77+
## License
78+
79+
[MIT][license] © [Titus Wormer][author]
80+
81+
<!-- Definitions -->
82+
83+
[build-badge]: https://img.shields.io/travis/wooorm/remark.svg
84+
85+
[build-status]: https://travis-ci.org/wooorm/remark
86+
87+
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/remark.svg
88+
89+
[coverage-status]: https://codecov.io/github/wooorm/remark
90+
91+
[chat-badge]: https://img.shields.io/gitter/room/wooorm/remark.svg
92+
93+
[chat]: https://gitter.im/wooorm/remark
94+
95+
[license]: https://github.com/wooorm/remark/blob/master/LICENSE
96+
97+
[author]: http://wooorm.com
98+
99+
[npm]: https://docs.npmjs.com/cli/install
100+
101+
[remark]: https://github.com/wooorm/remark
102+
103+
[plugins]: https://github.com/wooorm/remark/blob/master/doc/plugins.md
104+
105+
[markdown-extensions]: https://github.com/sindresorhus/markdown-extensions
106+
107+
[config-file]: https://github.com/wooorm/unified-engine/blob/master/doc/configure.md
108+
109+
[ignore-file]: https://github.com/wooorm/unified-engine/blob/master/doc/ignore.md
110+
111+
[unified-args]: https://github.com/wooorm/unified-args#cli

0 commit comments

Comments
 (0)