-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tools: introduce make mdlint
command and tools
#12756
Changes from all commits
a2f0299
608be0b
9a1a899
99272ff
d44935b
cd52693
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,5 @@ | ||
{ | ||
"plugins": { | ||
"remark-lint/": { | ||
"blockquote-indentation": 2, | ||
"checkbox-character-style": { "checked": "x", "unchecked": " " }, | ||
"checkbox-content-indent": true, | ||
"code-block-style": "fenced", | ||
"definition-case": false, | ||
"definition-spacing": true, | ||
"emphasis-marker": false, | ||
"fenced-code-flag": true, | ||
"fenced-code-marker": "`", | ||
"file-extension": "md", | ||
"final-definition": true, | ||
"final-newline": true, | ||
"first-heading-level": 1, | ||
"hard-break-spaces": true, | ||
"heading-increment": false, | ||
"heading-style": "atx", | ||
"link-title-style": false, | ||
"list-item-bullet-indent": false, | ||
"list-item-content-indent": false, | ||
"list-item-indent": false, | ||
"list-item-spacing": false, | ||
"maximum-heading-length": false, | ||
"maximum-line-length": false, | ||
"no-auto-link-without-protocol": true, | ||
"no-blockquote-without-caret": true, | ||
"no-consecutive-blank-lines": false, | ||
"no-duplicate-definitions": true, | ||
"no-duplicate-headings": false, | ||
"no-emphasis-as-heading": false, | ||
"no-file-name-articles": true, | ||
"no-file-name-consecutive-dashes": true, | ||
"no-file-name-irregular-characters": false, | ||
"no-file-name-mixed-case": false, | ||
"no-file-name-outer-dashes": true, | ||
"no-heading-content-indent": true, | ||
"no-heading-indent": true, | ||
"no-heading-punctuation": false, | ||
"no-html": false, | ||
"no-inline-padding": true, | ||
"no-literal-urls": false, | ||
"no-missing-blank-lines": false, | ||
"no-multiple-toplevel-headings": true, | ||
"no-shell-dollars": true, | ||
"no-shortcut-reference-image": true, | ||
"no-shortcut-reference-link": false, | ||
"no-table-indentation": true, | ||
"no-tabs": true, | ||
"no-undefined-references": false, | ||
"no-unused-definitions": true, | ||
"ordered-list-marker-style": false, | ||
"ordered-list-marker-value": false, | ||
"rule-style": true, | ||
"strong-marker": "*", | ||
"table-cell-padding": "padded", | ||
"table-pipe-alignment": false, | ||
"table-pipes": true, | ||
"unordered-list-marker-style": false | ||
} | ||
} | ||
"plugins": [ | ||
"./tools/remark-preset-lint-node/" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <tituswormer@gmail.com> (http://wooorm.com)", | ||
"contributors": [ | ||
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)" | ||
], | ||
"bin": { | ||
"remark": "cli.js" | ||
}, | ||
"files": [ | ||
"cli.js" | ||
], | ||
"scripts": {}, | ||
"xo": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <path> specify configuration file | ||
-i --ignore-path <path> specify ignore file | ||
-s --setting <settings> specify settings | ||
-e --ext <extensions> specify extensions | ||
-u --use <plugins> use plugins | ||
-p --preset <presets> 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 <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] | ||
|
||
<!-- Definitions --> | ||
|
||
[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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// @see https://github.com/nodejs/node/blob/master/doc/STYLE_GUIDE.md | ||
|
||
'use strict'; | ||
|
||
module.exports.plugins = [ | ||
require('remark-lint'), | ||
require('remark-lint-checkbox-content-indent'), | ||
require('remark-lint-definition-spacing'), | ||
require('remark-lint-fenced-code-flag'), | ||
require('remark-lint-final-definition'), | ||
require('remark-lint-final-newline'), | ||
require('remark-lint-hard-break-spaces'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are trailing spaces (necessary for this rule) possible in our docs? Should they be eliminated but properly configured git on committing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought it was possible but .gitattributes | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitattributes b/.gitattributes
index fa5162684b..ad2efae71b 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1,3 @@
test/fixtures/* -text
vcbuild.bat text eol=crlf
+**/*.md whitespace=-trailing-space,space-before-tab,-indent-with-non-tab,tab-in-indent,cr-at-eol There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently, we have no trailing spaces in docs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because we do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I mean if we manage without trailing spaces so far, may be it is not worth to bring them in? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ack. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is a pity that |
||
require('remark-lint-no-auto-link-without-protocol'), | ||
require('remark-lint-no-blockquote-without-caret'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems this is renamed: https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-no-blockquote-without-marker |
||
require('remark-lint-no-duplicate-definitions'), | ||
require('remark-lint-no-file-name-articles'), | ||
require('remark-lint-no-file-name-consecutive-dashes'), | ||
require('remark-lint-no-file-name-outer-dashes'), | ||
require('remark-lint-no-heading-content-indent'), | ||
require('remark-lint-no-heading-indent'), | ||
require('remark-lint-no-inline-padding'), | ||
require('remark-lint-no-multiple-toplevel-headings'), | ||
require('remark-lint-no-shell-dollars'), | ||
require('remark-lint-no-shortcut-reference-image'), | ||
require('remark-lint-no-table-indentation'), | ||
require('remark-lint-no-tabs'), | ||
require('remark-lint-no-unused-definitions'), | ||
require('remark-lint-rule-style'), | ||
require('remark-lint-table-pipes'), | ||
[require('remark-lint-blockquote-indentation'), 2], | ||
[ | ||
require('remark-lint-checkbox-character-style'), | ||
{ | ||
'checked': 'x', 'unchecked': ' ' | ||
} | ||
], | ||
[require('remark-lint-code-block-style'), 'fenced'], | ||
[require('remark-lint-fenced-code-marker'), '`'], | ||
[require('remark-lint-file-extension'), 'md'], | ||
[require('remark-lint-first-heading-level'), 1], | ||
[require('remark-lint-heading-style'), 'atx'], | ||
[require('remark-lint-strong-marker'), '*'], | ||
[require('remark-lint-table-cell-padding'), 'padded'] | ||
]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"private": true, | ||
"name": "remark-preset-lint-node", | ||
"version": "1.0.0", | ||
"description": "remark preset to configure remark-lint with settings for nodejs/node", | ||
"main": "index.js", | ||
"dependencies": { | ||
"remark-lint": "^6.0.0", | ||
"remark-lint-blockquote-indentation": "^1.0.0", | ||
"remark-lint-checkbox-character-style": "^1.0.0", | ||
"remark-lint-checkbox-content-indent": "^1.0.0", | ||
"remark-lint-code-block-style": "^1.0.0", | ||
"remark-lint-definition-spacing": "^1.0.0", | ||
"remark-lint-fenced-code-flag": "^1.0.0", | ||
"remark-lint-fenced-code-marker": "^1.0.0", | ||
"remark-lint-file-extension": "^1.0.0", | ||
"remark-lint-final-definition": "^1.0.0", | ||
"remark-lint-final-newline": "^1.0.0", | ||
"remark-lint-first-heading-level": "^1.0.0", | ||
"remark-lint-hard-break-spaces": "^1.0.1", | ||
"remark-lint-heading-style": "^1.0.0", | ||
"remark-lint-no-auto-link-without-protocol": "^1.0.0", | ||
"remark-lint-no-blockquote-without-caret": "^1.0.0", | ||
"remark-lint-no-duplicate-definitions": "^1.0.0", | ||
"remark-lint-no-file-name-articles": "^1.0.0", | ||
"remark-lint-no-file-name-consecutive-dashes": "^1.0.0", | ||
"remark-lint-no-file-name-outer-dashes": "^1.0.0", | ||
"remark-lint-no-heading-content-indent": "^1.0.0", | ||
"remark-lint-no-heading-indent": "^1.0.0", | ||
"remark-lint-no-inline-padding": "^1.0.0", | ||
"remark-lint-no-multiple-toplevel-headings": "^1.0.0", | ||
"remark-lint-no-shell-dollars": "^1.0.0", | ||
"remark-lint-no-shortcut-reference-image": "^1.0.0", | ||
"remark-lint-no-table-indentation": "^1.0.0", | ||
"remark-lint-no-tabs": "^1.0.0", | ||
"remark-lint-no-unused-definitions": "^1.0.0", | ||
"remark-lint-rule-style": "^1.0.0", | ||
"remark-lint-strong-marker": "^1.0.0", | ||
"remark-lint-table-cell-padding": "^1.0.0", | ||
"remark-lint-table-pipes": "^1.0.0" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably edit the
$(TARBALL)
target as well, to exclude thetools/remark*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right! I added it on L717.