Run textlint rule on browser for testing.
If you want to know whether your textlint rule work or not, This Command line tool help you.
This tools did following steps:
- Bundle your textlint rule and @textlint/kernel by Browserify
- Run the bundle code on Electron browser by browser-run
- Output results
Install with npm:
npm install @textlint/browser-run --global
Usage
$ npx @textlint/browser-run <input-file-path>
Options
--ruleId rule id. Default: test-rule
--rule file path to rule module entry
--preset file path to rule preset module entry
Examples
$ npx @textlint/browser-run --rule ./lib/rule.js ./README.md
$ npx @textlint/browser-run --preset ./lib/rule-preset.js ./README.md
📝 Notes
You should specify rule js file that is build by textlint-scripts.
📝 Note for kuromojin
@textlint/browser-run
define window.kuromojin.dicPath
to https://kuromojin.netlify.com/dict/
by default for support kuromojin.
import * as fs from "fs"
import * as path from "path"
import { browserRun } from "@textlint/browser-run";
const ruleFile = require.resolve("./fixtures/rule.js");
browserRun({
input: fs.readFileSync(path.join(__dirname, "fixtures/README.md"), "utf-8"),
inputFilePath: path.join(__dirname, "fixtures/README.md"),
ruleFilePath: ruleFile,
ruleId: "test-rule",
cwd: __dirname
}).then(() => {
console.log("Work");
}).catch(error => {
console.log("Does not work")
});
See Releases page.
Install devDependencies and Run npm test
:
npm test
Pull requests and stars are always welcome.
For bugs and feature requests, please create an issue.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
MIT © azu