retext-google-styleguide

Word usage guidence from Google Developer Documentation Style Guide's word list.

MIT License

Downloads
285
Stars
5
Committers
2

retext-google-styleguide

Word usage guidence from Google Developer Documentation Style Guide.

retext-google-styleguide is a retext plugin for the word usage advice from Google Developer Documentation Style Guide. It highlights errors and provide word usage advice.

Installation

npm:

npm install retext-google-styleguide

Usage

For the following file, example.txt:

For 3-D rotation, abort the app first.
Then hit autoupdate to update the app.

And our script, example.js, looks as follows:

import {retext} from 'retext'
import googlestyleguide from 'retext-google-styleguide';
//import {readSync} from 'to-vfile'
import pkg from 'to-vfile'
const {readSync} = pkg;
import {reporter} from 'vfile-reporter'

retext()
  .use(googlestyleguide)
  .process(readSync('example.txt'), function (err, file) {
    console.error(reporter(err || file));
  });

Yields:

example.txt
    1:5-1:8  warning  Do not use. Replace with 3D.                             3-d         googlestyleguide
  1:19-1:24  warning  Do not use. Replace with stop, exit, cancel, end.  abort       googlestyleguide
    2:6-2:9  warning  Don't use as a synonym for "click."                        hit         googlestyleguide
  2:10-2:20  warning  Do not use. Replace with automatically update.           autoupdate  googlestyleguide

 4 warnings

API

retext().use(googlestyleguide)

Rules

See index.json