How to use the @textlint/kernel.TextlintKernel function in @textlint/kernel

To help you get started, we’ve selected a few @textlint/kernel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github textlint / textlint / packages / textlint / src / textlint-core.ts View on Github external
this.config = config;
        // Markdown and Text is enabled by default
        // Markdown and Text are for backward compatibility.
        this.defaultPlugins = [
            {
                pluginId: "markdown",
                plugin: markdownPlugin
            },
            {
                pluginId: "text",
                plugin: textPlugin
            }
        ];
        // TODO: remove `config`
        // https://github.com/textlint/textlint/issues/296
        this.kernel = new TextlintKernel(config);
        this.textlintKernelDescriptor = new TextlintKernelDescriptor({
            rules: [],
            plugins: this.defaultPlugins,
            filterRules: []
        });
    }
github textlint / playground / src / components / TextlintDemo / TextlintEditor.js View on Github external
import textlintToCodeMirror from "textlint-message-to-codemirror";
import { updateRuleErrors } from "../../actions/textlintActions";
import CodeMirrorEditor from "./CodeMirrorEditor";

require("codemirror/addon/mode/overlay.js");
require("codemirror/mode/xml/xml.js");
require("codemirror/mode/markdown/markdown.js");
require("codemirror/mode/gfm/gfm.js");
require("codemirror/mode/javascript/javascript.js");
require("codemirror/mode/css/css.js");
require("codemirror/mode/htmlmixed/htmlmixed.js");
require("codemirror/mode/clike/clike.js");
require("codemirror/mode/meta.js");
require("codemirror/addon/edit/continuelist.js");
require("codemirror/addon/lint/lint.js");
const textlintKernel = new TextlintKernel();
const createSetupRules = (rules, ruleOptions) => {
    return Object.keys(rules).map(ruleName => {
        return {
            ruleId: ruleName,
            rule: rules[ruleName],
            options: ruleOptions[ruleName]
        };
    });
};
let textlintOption = {};
const createValidator = ({ rules, rulesOption }) => {
    textlintOption = Object.assign(
        {},
        {
            rules: createSetupRules(rules, rulesOption),
            plugins: [

@textlint/kernel

textlint kernel is core logic by pure JavaScript.

MIT
Latest version published 13 days ago

Package Health Score

89 / 100
Full package analysis