Switch branches/tags
v7.4.0 v7.3.0 v7.2.2 v3.6.0 v3.5.0 v3.3.1 v3.3.0 v3.1.2 v3.1.1 txt-to-ast@3.0.3 txt-to-ast@3.0.2 txt-to-ast@3.0.1 txt-to-ast@3.0.0 txt-to-ast@3.0.0-next.0 txt-to-ast@2.0.0 txt-to-ast@2.0.0-beta.0 txt-ast-traverse@2.0.4 txt-ast-traverse@2.0.3 txt-ast-traverse@2.0.2 txt-ast-traverse@2.0.1 txt-ast-traverse@2.0.0 txt-ast-traverse@2.0.0-next.0 textlint@11.0.1 textlint@11.0.0 textlint@10.2.1 textlint@10.2.0 textlint@10.1.5 textlint@10.1.4 textlint@10.1.3 textlint@10.1.2 textlint@10.1.1 textlint@10.1.0 textlint@10.0.1 textlint@10.0.0 textlint@10.0.0-next.2 textlint@10.0.0-next.1 textlint@10.0.0-next.0 textlint@9.1.1 textlint@9.1.0 textlint@9.0.1 textlint@9.0.0 textlint@9.0.0-beta.0 textlint@8.2.1 textlint@8.2.0 textlint@8.1.0 textlint@8.0.1 textlint@8.0.0 @textlint/textlint-plugin-text@4.0.1 @textlint/textlint-plugin-text@4.0.0 @textlint/textlint-plugin-text@3.0.10 @textlint/textlint-plugin-text@3.0.9 @textlint/textlint-plugin-text@3.0.8 @textlint/textlint-plugin-text@3.0.7 @textlint/textlint-plugin-markdown@5.0.1 @textlint/textlint-plugin-markdown@5.0.0 @textlint/textlint-plugin-markdown@4.0.10 @textlint/textlint-plugin-markdown@4.0.9 @textlint/textlint-plugin-markdown@4.0.8 @textlint/textlint-plugin-markdown@4.0.7 @textlint/text-to-ast@3.0.9 @textlint/text-to-ast@3.0.8 @textlint/text-to-ast@3.0.7 @textlint/text-to-ast@3.0.6 @textlint/text-to-ast@3.0.5 @textlint/text-to-ast@3.0.4 @textlint/monorepo-scripts@2.0.0 @textlint/monorepo-scripts@2.0.0-beta.0 @textlint/markdown-to-ast@6.0.9 @textlint/markdown-to-ast@6.0.8 @textlint/markdown-to-ast@6.0.7 @textlint/markdown-to-ast@6.0.6 @textlint/markdown-to-ast@6.0.5 @textlint/markdown-to-ast@6.0.4 @textlint/linter-formatter@3.0.8 @textlint/linter-formatter@3.0.7 @textlint/linter-formatter@3.0.6 @textlint/linter-formatter@3.0.5 @textlint/linter-formatter@3.0.4 @textlint/linter-formatter@3.0.3 @textlint/kernel@3.0.0 @textlint/kernel@2.0.9 @textlint/kernel@2.0.8 @textlint/kernel@2.0.7 @textlint/kernel@2.0.6 @textlint/kernel@2.0.5 @textlint/kernel@2.0.4 @textlint/kernel@2.0.3 @textlint/kernel@2.0.2 @textlint/kernel@2.0.1 @textlint/kernel@2.0.0 @textlint/kernel@2.0.0-next.2 @textlint/kernel@2.0.0-next.1 @textlint/kernel@2.0.0-next.0 @textlint/kernel@1.0.3 @textlint/kernel@1.0.2 @textlint/kernel@1.0.1 @textlint/kernel@1.0.0 @textlint/kernel@1.0.0-beta.0 @textlint/kernel@0.2.1 @textlint/kernel@0.2.0
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
src
test
tools
.gitignore
CHANGELOG.md
LICENSE
README.md
package.json
tsconfig.json

README.md

@textlint/kernel

textlint kernel is core logic by pure JavaScript.

This module is a low layer of textlint.

No plugin, No rule, No filter rule by default.

Install

Install with npm:

npm install @textlint/kernel

Usage

import { TextlintKernel } from "@textlint/kernel";
const kernel = new TextlintKernel();
const options = {
    filePath: "/path/to/file.md",
    ext: ".md",
    plugins: [
        {
            pluginId: "markdown",
            plugin: require("@textlint/textlint-plugin-markdown")
        }
    ],
    rules: [
        {
            ruleId: "no-todo",
            rule: require("textlint-rule-no-todo")
        }
    ]
};
kernel.lintText("TODO: text", options).then(result => {
    assert.ok(typeof result.filePath === "string");
    assert.ok(result.messages.length === 1);
});

Type Interface

@textlint/kernel export core types of textlint.

If you use TypeScript, this types help you.

// Types
import {
    TextlintResult,
    TextlintFixResult,
    TextlintFixCommand,
    TextlintMessage,
    // Kernel rule/filter/plugin format
    TextlintKernelRule,
    TextlintKernelFilterRule,
    TextlintKernelPlugin,
    // textlint rule interface
    TextlintRuleCreator,
    TextlintRuleOptions,
    // textlint filter rule interface
    TextlintFilterRuleCreator,
    TextlintFilterRuleOptions,
    // textlint plugin interface
    TextlintPluginCreator,
    TextlintPluginOptions,
    TextlintPluginProcessor,
    TextlintPluginProcessorConstructor
} from "@textlint/kernel";

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm i -d && npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  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

Author

License

MIT © azu