From 3d499b371291b35bd319eb70c7244544eafdf278 Mon Sep 17 00:00:00 2001 From: Daijiro Wachi Date: Sun, 30 Apr 2017 18:08:25 +0200 Subject: [PATCH] tools: introduce remark-cli@3.0.1 PR-URL: https://github.com/nodejs/node/pull/12756 Reviewed-By: Refael Ackermann Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani --- tools/remark-cli/cli.js | 34 +++++++++++ tools/remark-cli/package.json | 32 ++++++++++ tools/remark-cli/readme.md | 111 ++++++++++++++++++++++++++++++++++ 3 files changed, 177 insertions(+) create mode 100755 tools/remark-cli/cli.js create mode 100644 tools/remark-cli/package.json create mode 100644 tools/remark-cli/readme.md diff --git a/tools/remark-cli/cli.js b/tools/remark-cli/cli.js new file mode 100755 index 00000000000000..6bbb1d656410c1 --- /dev/null +++ b/tools/remark-cli/cli.js @@ -0,0 +1,34 @@ +#!/usr/bin/env node +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:cli + * @fileoverview CLI to process markdown. + */ + +'use strict'; + +/* Dependencies. */ +var start = require('unified-args'); +var extensions = require('markdown-extensions'); +var processor = require('remark'); +var proc = require('remark/package.json'); +var cli = require('./package.json'); + +/* Start. */ +start({ + processor: processor, + name: proc.name, + description: cli.description, + version: [ + proc.name + ': ' + proc.version, + cli.name + ': ' + cli.version + ].join(', '), + pluginPrefix: proc.name, + presetPrefix: proc.name + '-preset', + packageField: proc.name + 'Config', + rcName: '.' + proc.name + 'rc', + ignoreName: '.' + proc.name + 'ignore', + extensions: extensions +}); diff --git a/tools/remark-cli/package.json b/tools/remark-cli/package.json new file mode 100644 index 00000000000000..c6e24e44676683 --- /dev/null +++ b/tools/remark-cli/package.json @@ -0,0 +1,32 @@ +{ + "name": "remark-cli", + "version": "3.0.1", + "description": "CLI to process markdown with remark using plugins", + "license": "MIT", + "keywords": [ + "markdown", + "remark", + "cli", + "bin" + ], + "dependencies": { + "markdown-extensions": "^1.1.0", + "remark": "^7.0.0", + "unified-args": "^3.0.0" + }, + "homepage": "http://remark.js.org", + "repository": "https://github.com/wooorm/remark/tree/master/packages/remark-cli", + "bugs": "https://github.com/wooorm/remark/issues", + "author": "Titus Wormer (http://wooorm.com)", + "contributors": [ + "Titus Wormer (http://wooorm.com)" + ], + "bin": { + "remark": "cli.js" + }, + "files": [ + "cli.js" + ], + "scripts": {}, + "xo": false +} diff --git a/tools/remark-cli/readme.md b/tools/remark-cli/readme.md new file mode 100644 index 00000000000000..ede14ec3687b71 --- /dev/null +++ b/tools/remark-cli/readme.md @@ -0,0 +1,111 @@ +# remark-cli [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat] + +Command-line interface for [**remark**][remark]. + +* Loads [`remark-` plugins][plugins] +* Searches for [markdown extensions][markdown-extensions] +* Ignores paths found in [`.remarkignore` files][ignore-file] +* Loads configuration from [`.remarkrc`, `.remarkrc.js` files][config-file] +* Uses configuration from [`remarkConfig` fields in `package.json` + files][config-file] + +## Installation + +[npm][]: + +```sh +npm install remark-cli +``` + +## Usage + +```sh +# Add a table of contents to `readme.md` +$ remark readme.md --use toc --output + +# Lint markdown files in the current directory +# according to the markdown style guide. +$ remark . --use preset-lint-markdown-style-guide +``` + +## CLI + +See [**unified-args**][unified-args], which provides the interface, +for more information on all available options. + +```txt +Usage: remark [options] [path | glob ...] + + CLI to process markdown with remark using plugins + +Options: + + -h --help output usage information + -v --version output version number + -o --output [path] specify output location + -r --rc-path specify configuration file + -i --ignore-path specify ignore file + -s --setting specify settings + -e --ext specify extensions + -u --use use plugins + -p --preset use presets + -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 + -t --tree specify input and output as syntax tree + --file-path specify path to process as + --tree-in specify input as syntax tree + --tree-out output 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) + +Examples: + + # Process `input.md` + $ remark input.md -o output.md + + # Pipe + $ remark < input.md > output.md + + # Rewrite all applicable files + $ remark . -o +``` + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/wooorm/remark.svg + +[build-status]: https://travis-ci.org/wooorm/remark + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/remark.svg + +[coverage-status]: https://codecov.io/github/wooorm/remark + +[chat-badge]: https://img.shields.io/gitter/room/wooorm/remark.svg + +[chat]: https://gitter.im/wooorm/remark + +[license]: https://github.com/wooorm/remark/blob/master/LICENSE + +[author]: http://wooorm.com + +[npm]: https://docs.npmjs.com/cli/install + +[remark]: https://github.com/wooorm/remark + +[plugins]: https://github.com/wooorm/remark/blob/master/doc/plugins.md + +[markdown-extensions]: https://github.com/sindresorhus/markdown-extensions + +[config-file]: https://github.com/wooorm/unified-engine/blob/master/doc/configure.md + +[ignore-file]: https://github.com/wooorm/unified-engine/blob/master/doc/ignore.md + +[unified-args]: https://github.com/wooorm/unified-args#cli