Skip to content

plugin to check for weak and mitigating wording

License

Notifications You must be signed in to change notification settings

retextjs/retext-intensify

Repository files navigation

retext-intensify

Build Coverage Downloads Size Sponsors Backers Chat

retext plugin to check for weak and mitigating wording.

Contents

What is this?

This package is a unified (retext) plugin to check for words that are weak: weasels, hedges, and fillers.

When should I use this?

You can opt-into this plugin when you’re dealing with content that might contain vague wording, and have authors that can fix that content.

Install

This package is ESM only. In Node.js (version 16+), install with npm:

npm install retext-intensify

In Deno with esm.sh:

import retextIntensify from 'https://esm.sh/retext-intensify@7'

In browsers with esm.sh:

<script type="module">
  import retextIntensify from 'https://esm.sh/retext-intensify@7?bundle'
</script>

Use

Say our document example.txt contains:

Some people say there are quite some
problems, apparently.

…and our module example.js contains:

import {retext} from 'retext'
import retextIntensify from 'retext-intensify'
import {read} from 'to-vfile'
import {reporter} from 'vfile-reporter'

const file = await retext()
  .use(retextIntensify)
  .process(await read('example.txt'))

console.error(reporter(file))

…then running node example.js yields:

example.txt
1:1-1:5   warning Unexpected weasel (vague or ambiguous) word `Some`    weasel retext-intensify
1:13-1:16 warning Unexpected hedge (uncertain or indecisive) word `say` hedge  retext-intensify
1:27-1:32 warning Unexpected weasel (vague or ambiguous) word `quite`   weasel retext-intensify
1:33-1:37 warning Unexpected weasel (vague or ambiguous) word `some`    weasel retext-intensify
2:11-2:21 warning Unexpected filler (meaningless) word `apparently`     filler retext-intensify

⚠ 5 warnings

API

This package exports no identifiers. The default export is retextIntensify.

unified().use(retextIntensify[, options])

Check for weak and mitigating wording.

Parameters
  • options (Options, optional) — configuration
Returns

Transform (Transformer).

Options

Configuration (TypeScript type).

Fields
  • ignore (Array<string>, optional) — phrases not to warn about

Messages

Each message is emitted as a VFileMessage on file, with source set to 'retext-intensify', ruleId to 'filler', 'hedge', or 'weasel', actual to the unexpected phrase, and expected to an empty array.

Types

This package is fully typed with TypeScript. It exports the additional type Options.

Compatibility

Projects maintained by the unified collective are compatible with maintained versions of Node.js.

When we cut a new major release, we drop support for unmaintained versions of Node. This means we try to keep the current release line, retext-intensify@^7, compatible with Node.js 16.

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