textlint / editor

textlint editor project.
https://textlint-editor.netlify.app/
MIT License
134 stars 8 forks source link

@textlint/editor

textlint editor is privacy first linting tool on your browser.

Usage

  1. Install Web Extensions
  2. Install your favorites textlint worker scripts
  3. Finally, you can linting any supported textarea with your textlint worker script

:memo: @textlint/editor web extension hook the access of https://*/*/textlint-worker.js. If you navigate to https://*/*/textlint-worker.js, the web extension open installation dialog like Greasemonkey Extension.

:memo: You want to use your customized rule, please use https://github.com/textlint/editor-script-template.

Supports textarea

If you want to support new textarea, please create an issues or pull request to textchecker-element.

Purpose

Grammarly and Microsoft Editor is useful and high-quality linting tools, but these require network access, and you must pass your text to their server.

textlint can be works at offline. Because, textlint is written by JavaScript, textlint rules are also written by JavaScript.

However, textlint is pluggable linting tools and textlint can not provide recommended/default ruleset.

@textlint/editor project resolve this issue using @textlint/script-compiler that generate optimized code from your textlint configuration.

Architecture

For example, WebExtension download own optimized textlint that is generated code @textlint/script-compiler, and use it for linting.

So, we can focus on the compiler and frontend of editor.

Develop

Install with yarn and build before editing files.

yarn install
yarn run build
cd packages/you want to edit

Develop web extension

yarn install
yarn run build
cd packages/webextension
yarn dev chrome # yarn dev firefox

Architecture

FrontEnd and BackEnd is separated.

WebComponent

Avoid side-effect on website.

Compiler target

@textlint/script-compiler generate bundled JavaScript code.

Compiler compilertextlint + rule + textlintrc into a single library code.

Also, We can provide @textlint/script-compiler as a service using codesandbox

API

The library has some API

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

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