The pluggable natural language linter for text and markdown.
MIT License
Bot releases are visible (Hide)
.textlintrc
config fileAllow to config the textlint rules by .textlintrc
file.
Textlint find a .textlintrc
in the current dir or related dir, and use it as config.
Also, specify config file by use of --config
command line options.
If you want to know about .textlintrc
, see https://github.com/azu/textlint#textlintrc
Example of config: azu/textlint-rule-max-ten
Published by azu about 9 years ago
--rule <rule package name>
option (af1e1b9)Published by azu over 9 years ago
feat(textlint): improve error report · 53c5909 · azu/textlint
RuleError:
RuleError
constructor 2nd arguments.paddingLocation
.paddingLocation
has line
and column
context.report(node, new context.RuleError(result.actual + " => " + result.expected, {
line: result.paddingLine,
column: result.paddingColumn
}));
Example:
1st line
2nd abc ERROR def
I want to find ERROR, come to be following:
context.report(node, new context.RuleError("found Error", {
line: 1,// padding line number
column: 8// padding column number
}));
use-case : feat(rule): improve linting result · 64fcd7d · azu/spellcheck-tech-word-textlint-rule
Published by azu over 9 years ago
use mdast instead of CommonMark by azu · Pull Request #3 · azu/markdown-to-ast
markdown-to-ast 3.0.0 has some breaking changes.
Break CommonMark dependent.
If you have used CommonMark-dependent code, it may be broken.
CodeBlock
Nodebefore:
CodeBlock.raw
have not contain CodeBlock mark like ```
var code = 1;
after:
CodeBlock.raw
have contain CodeBlock mark like ```
The raw value of CodeBlock
node is following:
```
var code = 1;
```
if you want to get only code value, can get from node.vaule
.
before(CommonMark):
Alt text of Image node is Str
node.
after(mdast):
Alt text of Image node is not Str
node.
It is true that Alt text is a attribute of Image Node.
Rename CLIEngine to TextLintEngine
Update document and please see docs/use-as-modules.md.
Usage:
"use strict";
var TextLintEngine = require("textlint").TextLintEngine;
var path = require("path");
function lintFile(filePath) {
/**
* @type {TextLintConfig}
* See lib/_typing/textlint.d.ts
*/
var options = {
// load rules from [../rules]
rulePaths: [path.join(__dirname, "..", "rules/")],
formatterName: "pretty-error"
};
var engine = new TextLintEngine(options);
var filePathList = [path.resolve(process.cwd(), filePath)];
var results = engine.executeOnFiles(filePathList);
if (engine.isErrorResults(results)) {
var output = engine.formatResults(results);
console.log(output);
}
}
Fixed the bug that duplicate error message.
Published by azu almost 10 years ago
markdown-to-ast
ver2 (f682d9f7)Update TxtNode interface and Creating Rules.
We use azu/markdown-to-ast as markdown parser module, now!
(It's based on CommonMarkdown)
It make context.getSource()
more correct!