retext-simplify
retext plugin to check phrases for simpler alternatives
Last updated 4 months ago by wooorm .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install retext-simplify 
SYNC missed versions from official npm registry.

retext-simplify

Build Coverage Downloads Size Sponsors Backers Chat

retext plugin to check phrases for simpler alternatives.

Install

npm:

npm install retext-simplify

Use

Say we have the following file, example.txt:

You can utilize a shorter word.
Be advised, don’t do this.
That’s the appropriate thing to do.

…and our script, example.js, looks as follows:

var vfile = require('to-vfile')
var report = require('vfile-reporter')
var retext = require('retext')
var simplify = require('retext-simplify')

retext()
  .use(simplify)
  .process(vfile.readSync('example.txt'), function(err, file) {
    console.error(report(err || file))
  })

Yields:

example.txt
   1:9-1:16  warning  Replace `utilize` with `use`                                utilize      retext-simplify
   2:1-2:11  warning  Remove `Be advised`                                         be-advised   retext-simplify
  3:12-3:23  warning  Replace `appropriate` with `proper`, `right`, or remove it  appropriate  retext-simplify

⚠ 3 warnings

API

retext().use(simplify[, options])

Check phrases for simpler alternatives.

options.ignore

Phrases not to warn about (Array.<string> - ruleIds).

Messages

Each message is emitted as a VFileMessage on file, with the following fields:

message.source

Name of this plugin ('retext-simplify').

message.ruleId

Normalized not ok phrase (string, such as 'utilize').

message.actual

Current not ok phrase (string, such as 'Utilize').

message.expected

List of suggestions (Array.<string>, such as ['use']).

Related

Contribute

See contributing.md in retextjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer

Current Tags

  • 6.0.0                                ...           latest (4 months ago)

14 Versions

  • 6.0.0                                ...           4 months ago
  • 5.1.0                                ...           5 months ago
  • 5.0.0                                ...           a year ago
  • 4.1.3                                ...           a year ago
  • 4.1.2                                ...           2 years ago
  • 4.1.1                                ...           3 years ago
  • 4.1.0                                ...           3 years ago
  • 4.0.0                                ...           3 years ago
  • 3.0.0                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago

Copyright 2014 - 2016 © taobao.org |