Home

Awesome

logo Write Better

Build Status

An English language grammar checker for Google docs. A.K.A the chrome extension port of Btford's WriteGood which is a bundling of different naive English language linters. I checked for grammatical errors on this README using WriteBetter ;)

Sample Suggestions

Features

Upcoming features:

Build the extension locally

  1. Download the repo
git clone http://github.com/justiceo/write-better  
  1. Install dependencies
cd write-better && npm install  
  1. Build the extension
gulp build

Extension directory would be in write-better/extension. See how to load an unpacked extension in chrome.

  1. Demo it (starts new browser instance with extension installed)
npm run start:firefox
npm run start:chrome

Other tasks

  1. Test the extension
gulp test
  1. Start the build in live-reload mode
gulp
  1. Create a release-able extension
git checkout -b release                         # Not necessary but preferable.
gulp clean                                      # Remove any artifacts from old builds and watch
gulp build                                      # Build the extension
zip -r extension.zip extension -x "*.DS_Store"  # Zip it up and upload to chrome dashboard.

To create .crx file (ensure previous .crx is removed first), use:

google-chrome --pack-extension=extension  [--pack-extension-key=<extension_key>]

Debugging

  1. Content script can be located in Chrome Devtools -> Sources -> Content Script. Ensure Console output level is VERBOSE
  2. Background script can be located in Manage Extensions -> (Find loaded extension) -> Background page.
  3. After a rebuild, reload extension using reload button on the extension card at chrome://extensions/

Manifest v3 schema - https://developer.chrome.com/docs/extensions/mv3/manifest/

PRs to track

  1. https://github.com/btford/passive-voice/pull/4
  2. https://github.com/duereg/no-cliches/pull/10
  3. https://github.com/duereg/too-wordy/pull/5

After which: update btford/write-good's dependencies.

Feedback

The only way I get feedback is when people complete this anonymous form or leave a review/comment on the extensions page. Please use them!

Release Notes

v0.0.7

Responsive Running lines counter, best implementation from https://stackoverflow.com/a/37623987

function countLines(target) {
      var style = window.getComputedStyle(target, null);
      var height = parseInt(style.getPropertyValue("height"));
      var font_size = parseInt(style.getPropertyValue("font-size"));
      var line_height = parseInt(style.getPropertyValue("line-height"));
      var box_sizing = style.getPropertyValue("box-sizing");
      
      if(isNaN(line_height)) line_height = font_size * 1.2;
     
      if(box_sizing=='border-box')
      {
        var padding_top = parseInt(style.getPropertyValue("padding-top"));
        var padding_bottom = parseInt(style.getPropertyValue("padding-bottom"));
        var border_top = parseInt(style.getPropertyValue("border-top-width"));
        var border_bottom = parseInt(style.getPropertyValue("border-bottom-width"));
        height = height - padding_top - padding_bottom - border_top - border_bottom
      }
      var lines = Math.ceil(height / line_height);
      alert("Lines: " + lines);
      return lines;
    }
    countLines(document.getElementById("foo"));