Giter Site home page Giter Site logo

kdzwinel / proofreader Goto Github PK

View Code? Open in Web Editor NEW
333.0 7.0 20.0 768 KB

Simple text proofreader based on 'write-good' (hemingway-app-like suggestions) and 'nodehun' (spelling).

License: MIT License

JavaScript 99.77% HTML 0.23%
proofreader spellcheck

proofreader's Introduction

Proofreader Build Status npm version

Proofreader takes a website, or a local file, and tries to proofread it using write-good and nodehun.

Installation

npm install proofreader -g

Examples

proofreader -u https://raw.githubusercontent.com/GoogleChrome/devtools-docs/master/docs/memory-analysis-101.html
proofreader -f ../devtools-docs/docs/commandline-api.md
proofreader -l list-of-files.txt
proofreader -c custom-config.json -f file.html

Output: Console output

  • blue suggestions come from write-good
  • magenta suggestions come from nodehun

Options

Proofreader can handle both HTML and Markdown files. It distinguishes between these two using MIME types.

--url (-u)

Downloads and processes single remote file from given URL.

--file (-f)

Processes single local file from given path.

--file-list (-l)

Processes all sources listed in the provided file. Sample list file:

../docs/file.html
/home/developer/otherfile.md
http://localhost/remote-file.md

--config-file (-c)

Path to a custom configuration file (default one is in settings.json). This file has to be a valid JSON. Sample configuration:

{
  "dictionaries": {
    "build-in": ["en_US", "en_GB"],
    "custom": ["devtools-docs.dic"]
  },
  "selectors": {
    "whitelist": "p, li, h1, h2, h3, h4, th, td, dl, figcaption",
    "blacklist": "pre, code"
  },
  "write-good": {
    "weasel": false
  }
}
  • dictionaries
    • build-in - one or two of build in dictionaries (eng_GB, eng_US). E.g. when both American English and British English are allowed, ["en_US", "en_GB"] should be specified.
    • custom - list of custom dictionaries
  • selectors
    • whitelist - CSS selector that specifies all elements that should be processed. This also applies to Markdown which is compiled to HTML before processing.
    • blacklist - All elements that match this CSS selector will be removed before proofreading.
    • write-good - Additional settings for write-good (more details here).

Notes

Please note that this project was:

  • optimized for Chrome DevTools docs
  • optimized for HTML and Markdown
  • optimized for English
  • by default does not process all the tags, only whitelisted ones (e.g. P, LI, H1, H2, H3)

proofreader's People

Contributors

kdzwinel avatar thrillberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

proofreader's Issues

Check URLs

Check for broken links in all <a> tags.

JSLint

JSLint the <code> and <pre> blocks.

Publish to npm

Is this published on npm? Searched and couldn't find it.

Command line app

You can make this an easily-installable command line app if you add a "bin" property to package.json. Here's an example for webtorrent: https://github.com/feross/webtorrent/blob/master/package.json#L11

Then users can get it without using git clone, just like this:

npm install proofreader -g   // installs a `proofreader` command line program
proofreader /path/to/file

The -g tells npm to install the program globally and add it to the PATH.

Editor plugins

It would be very nice to have some plugins to major editors to automatically run the proofreader on different events (like saving of a file.) This would help give more immediate feedback to authors about their work for a given project instead of manually running it or letting it run in Travis as a PR or commit is made.

Editors to target:

  • Sublime Text
  • vim [In progress]
  • Your editor here...

Use it in a webapp

Hi @kdzwinel! I was looking to use this within a webapp, and was wondering if the library is geared towards that sort of a use and if there are any examples/demo along those lines? Thank you!

npm global install command fails

When I run the first command on the README - npm install proofreader -g, it fails with the following error.

node version: 18.16.0, Apple M1 chip, Python3

nikhilnanjappa@Nikhils-MacBook-Pro ~ % npm install proofreader -g
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 1
npm ERR! path /Users/nikhilnanjappa/.npm-global/lib/node_modules/proofreader/node_modules/nodehun
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! CXX(target) Release/obj.target/hunspell/src/hunspell/src/hunspell/affentry.o
npm ERR!   CXX(target) Release/obj.target/hunspell/src/hunspell/src/hunspell/affixmgr.o
npm ERR!   CXX(target) Release/obj.target/hunspell/src/hunspell/src/hunspell/csutil.o
npm ERR!   CXX(target) Release/obj.target/hunspell/src/hunspell/src/hunspell/filemgr.o
npm ERR!   CXX(target) Release/obj.target/hunspell/src/hunspell/src/hunspell/hashmgr.o
npm ERR!   CXX(target) Release/obj.target/hunspell/src/hunspell/src/hunspell/hunspell.o
npm ERR!   CXX(target) Release/obj.target/hunspell/src/hunspell/src/hunspell/hunzip.o
npm ERR!   CXX(target) Release/obj.target/hunspell/src/hunspell/src/hunspell/phonet.o
npm ERR!   CXX(target) Release/obj.target/hunspell/src/hunspell/src/hunspell/replist.o
npm ERR!   CXX(target) Release/obj.target/hunspell/src/hunspell/src/hunspell/strmgr.o
npm ERR!   CXX(target) Release/obj.target/hunspell/src/hunspell/src/hunspell/suggestmgr.o
npm ERR!   LIBTOOL-STATIC Release/hunspell.a
npm ERR!   CXX(target) Release/obj.target/nodehun/src/nodehun.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.11.4 found at "/opt/homebrew/opt/[email protected]/bin/python3.11"
npm ERR! gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.11
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/nikhilnanjappa/.npm-global/lib/node_modules/proofreader/node_modules/nodehun/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/nikhilnanjappa/Library/Caches/node-gyp/18.16.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/nikhilnanjappa/Library/Caches/node-gyp/18.16.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/nikhilnanjappa/Library/Caches/node-gyp/18.16.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/nikhilnanjappa/.npm-global/lib/node_modules/proofreader/node_modules/nodehun',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! ../src/hunspell/src/hunspell/strmgr.cxx:79:19: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
npm ERR!   fprintf(stderr, err);
npm ERR!                   ^~~
npm ERR! ../src/hunspell/src/hunspell/strmgr.cxx:79:19: note: treat the string as an argument to avoid this
npm ERR!   fprintf(stderr, err);
npm ERR!                   ^
npm ERR!                   "%s",

Modularize

Split up monolithic proofreader.js into modules.

Flag to not run nodehun

It would be nicer for extensions if we could get a flag to not run nodehun and only get the actual grammar suggestions. Different editors can have different ways to setup spell-checking with custom dictionaries by default which would provide better (and faster) integration then running it through this.

Run "proofreader -f *.md" is impossible?

Hi, I was wondering if it was possible to proofread, for example, every .md file in the directory like this:
proofreader -f *.md
When I tried running this, only the first md file was read.
When I attempted
proofreader -l *.md
it tried to find the files corresponding to the sentences in the first md file. So if my first sentence was "This is my first post.", It tried to find the file at /This is my first post.
Is this possible or not?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.