<commit_before># textlint [![Build Status](https://travis-ci.org/azu/textlint.svg)](https://travis-ci.org/azu/textlint)

The pluggable linting tool for text(plain text and markdown).

It is similar to [ESLint](http://eslint.org/ "ESLint").

## Installation

```
$ npm install textlint -g
```

## Usage

![todo:lint result](http://monosnap.com/image/9FeIQr95kXjGPWFjZFRq6ZFG16YscF.png)

- [ ]  more more document


```
$ textlint README.md
```

## CLI

See help.

```
$ textlint -h
textlint [options] file.md [file.txt] [dir]

Options:
  -h, --help                 Show help.
  --rulesdir [path::String]  Set rules from this directory and set all default rules to off.
  -f, --format String        Use a specific output format. - default: stylish
  -v, --version              Outputs the version number.
  --ext [String]             Specify text file extensions.
  --no-color                 Enable color in piped output.
  -o, --output-file path::String  Enable report to be written to a file.
  --quiet                    Report errors only. - default: false
  --stdin                    Lint code provided on <STDIN>. - default: false
```

### Built-in formatters

Currently, you can use "stylish" (defaults), "compact", "checkstyle", "jslint-xml", "junit", "tap", "pretty-error".

e.g.) use pretty-error.js

```
$ textlint -f pretty-error file.md
```

More detail in [azu/textlint-formatter](https://github.com/azu/textlint-formatter "azu/textlint-formatter").

## Use as node modules

You can use textlint as node modules.

```
$ npm install textlint --save-dev
```

Minimal usage:

```js
var TextLintEngine = require("textlint").TextLintEngine;
var engine = new TextLintEngine({
    rulePaths: ["path/to/rule-dir"]
});
var results = engine.executeOnFiles(["README.md"]);
console.log(results[0].filePath);// => "README.md"
console.log(results[0].messages);// => [{message:"lint message"}]
if (engine.isErrorResults(results)) {
    var output = engine.formatResults(results);
    console.log(output);
}
```

High level usage:

```js
var textlint = require("textlint").textlint;
textlint.setupRules({
    // rule-key : rule function(see docs/create-rules.md)
    "rule-key": function(context){
        var exports = {};
        exports[context.Syntax.Str] = function (node) {
            context.report(node, new context.RuleError("error message"));
        };
        return exports;
    }
});
var results = cliEngine.executeOnFiles(["README.md"]);
console.log(results[0].filePath);// => "README.md"
console.log(results[0].messages);// => [{message:"lint message"}]
```

More detail:

- See [docs/use-as-modules.md](docs/use-as-modules.md)

## FAQ: How to create rules?

Please see docs/

- [docs/txtnode.md](docs/txtnode.md)
    - What is is TxtNode?
- [docs/create-rules.md](docs/create-rules.md)
    - How to create rules?
    - Tutorial: creating `no-todo` rule.

## Contributing

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## License

MIT

and

`lib/load-rules.js`, `util/traverse.js`, `cli.js`  are:

    ESLint
    Copyright (c) 2013 <NAME>. All rights reserved.
    https://github.com/eslint/eslint/blob/master/LICENSE
<commit_msg>docs(readme): update usage<commit_after># textlint [![Build Status](https://travis-ci.org/azu/textlint.svg)](https://travis-ci.org/azu/textlint)

The pluggable linting tool for text(plain text and markdown).

It is similar to [ESLint](http://eslint.org/ "ESLint").

## Installation

```
$ npm install textlint -g
```

## Usage

textlint has not default rule!!

Should use textlint with `--rule` or `--ruledir`.

![todo:lint result](http://monosnap.com/image/9FeIQr95kXjGPWFjZFRq6ZFG16YscF.png)

- [ ]  more more document


```
# install textlint rule
$ npm install --save-dev textlint-rule-no-todo
# use with `textlint-rule-no-todo` rule
$ textlint --rule textlint-rule-no-todo README.md
```

## CLI

See help.

```
$ textlint -h
textlint [options] file.md [file.txt] [dir]

Options:
  -h, --help                 Show help.
  --rule [path::String]      Set rule package name and set all default rules to off.
  --rulesdir [path::String]  Set rules from this directory and set all default rules to off.
  -f, --format String        Use a specific output format. - default: stylish
  -v, --version              Outputs the version number.
  --ext [String]             Specify text file extensions.
  --no-color                 Enable color in piped output.
  -o, --output-file path::String  Enable report to be written to a file.
  --quiet                    Report errors only. - default: false
  --stdin                    Lint code provided on <STDIN>. - default: false
```

also allow to use with multiple rules.

```sh
$ textlint --rule textlint-rule-no-todo --rule textlint-rule-some README.md
```

### Built-in formatters

Currently, you can use "stylish" (defaults), "compact", "checkstyle", "jslint-xml", "junit", "tap", "pretty-error".

e.g.) use pretty-error.js

```
$ textlint -f pretty-error file.md
```

More detail in [azu/textlint-formatter](https://github.com/azu/textlint-formatter "azu/textlint-formatter").

## Use as node modules

You can use textlint as node modules.

```
$ npm install textlint --save-dev
```

Minimal usage:

```js
var TextLintEngine = require("textlint").TextLintEngine;
var engine = new TextLintEngine({
    rulePaths: ["path/to/rule-dir"]
});
var results = engine.executeOnFiles(["README.md"]);
console.log(results[0].filePath);// => "README.md"
console.log(results[0].messages);// => [{message:"lint message"}]
if (engine.isErrorResults(results)) {
    var output = engine.formatResults(results);
    console.log(output);
}
```

High level usage:

```js
var textlint = require("textlint").textlint;
textlint.setupRules({
    // rule-key : rule function(see docs/create-rules.md)
    "rule-key": function(context){
        var exports = {};
        exports[context.Syntax.Str] = function (node) {
            context.report(node, new context.RuleError("error message"));
        };
        return exports;
    }
});
var results = cliEngine.executeOnFiles(["README.md"]);
console.log(results[0].filePath);// => "README.md"
console.log(results[0].messages);// => [{message:"lint message"}]
```

More detail:

- See [docs/use-as-modules.md](docs/use-as-modules.md)

## FAQ: How to create rules?

Please see docs/

- [docs/txtnode.md](docs/txtnode.md)
    - What is is TxtNode?
- [docs/create-rules.md](docs/create-rules.md)
    - How to create rules?
    - Tutorial: creating `no-todo` rule.

## Contributing

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## License

MIT and

`lib/load-rules.js`, `util/traverse.js`, `cli.js`  are:

    ESLint
    Copyright (c) 2013 <NAME>. All rights reserved.
    https://github.com/eslint/eslint/blob/master/LICENSE

{'fraction_non_alphanumeric': 0.15632054176072235, 'fraction_numerical': 0.00536117381489842, 'mean_word_length': 3.1823008849557524, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4896300', 'n_tokens_mistral': 2439, 'n_tokens_neox': 2348, 'n_words': 642}