unified

Project: retextjs/retext-diacritics

Package: retext-diacritics@4.2.0

  1. Dependents: 0
  2. retext plugin to check for proper use of diacritics
  1. unified 169
  2. plugin 131
  3. retext 34
  4. retext-plugin 22
  5. words 3

retext-diacritics

Build Coverage Downloads Size Sponsors Backers Chat

retext plugin to check for proper use of diacritics.

Contents

What is this?

This package is a unified (retext) plugin to check for certain words that should have diacritics, such as Beyonce -> Beyoncé.

When should I use this?

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

Install

This package is ESM only. In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with npm:

npm install retext-diacritics

In Deno with esm.sh:

import retextDiacritics from 'https://esm.sh/retext-diacritics@4'

In browsers with esm.sh:

<script type="module">
  import retextDiacritics from 'https://esm.sh/retext-diacritics@4?bundle'
</script>

Use

Say our document example.txt contains:

Beyonce is the creme fresh on his resume.

…and our module example.js looks as follows:

import {read} from 'to-vfile'
import {reporter} from 'vfile-reporter'
import {unified} from 'unified'
import retextEnglish from 'retext-english'
import retextDiacritics from 'retext-diacritics'
import retextStringify from 'retext-stringify'

const file = await unified()
  .use(retextEnglish)
  .use(retextDiacritics)
  .use(retextStringify)
  .process(await read('example.txt'))

console.error(reporter(file))

…now running node example.js yields:

example.txt
    1:1-1:8  warning  Replace `Beyonce` with `Beyoncé`            beyonce      retext-diacritics
  1:16-1:27  warning  Replace `creme fresh` with `crème fraîche`  creme-fresh  retext-diacritics
  1:31-1:41  warning  Replace `his resume` with `his résumé`      his-resume   retext-diacritics

⚠ 3 warnings

API

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

unified().use(retextDiacritics)

Check for proper use of diacritics.

Messages

The following VFileMessages are used:

sourceruleIdIncorrectCorrect
retext-diacriticsangstromAngstromÅngström
retext-diacriticsa-la-cartea la carteà la carte
retext-diacriticsa-la-modea la modeà la mode
retext-diacriticsa-resumea resumea résumé
retext-diacriticsacaiacaiaçaí
retext-diacriticsangstromangstromångström
retext-diacriticsbeau-idealbeau idealbeau idéal
retext-diacriticsbeyoncebeyoncebeyoncé
retext-diacriticsboutonniereboutonniereboutonnière
retext-diacriticsbric-a-bracbric-a-bracbric-à-brac
retext-diacriticsbrontebrontebrontë
retext-diacriticscafecafecafé
retext-diacriticscause-celebrecause celebrecause célèbre
retext-diacriticschamps-elyseeschamps-elyseeschamps-Élysées
retext-diacriticschevrechevrechèvre
retext-diacriticscitroencitroencitroën
retext-diacriticsclicheclichecliché
retext-diacriticscomme-ci-comme-cacomme ci comme cacomme ci comme ça
retext-diacriticscomsi-comsacomsi comsacomme ci comme ça
retext-diacriticsconsommeconsommeconsommé
retext-diacriticscoup-d'etatcoup d'etatcoup d'état
retext-diacriticscoup-de-gracecoup de gracecoup de grâce
retext-diacriticscreme-bruleecreme bruleecrème brûlée
retext-diacriticscreme-de-menthecreme de menthecrème de menthe
retext-diacriticscreme-fraicecreme fraicecrème fraîche
retext-diacriticscreme-freshcreme freshcrème fraîche
retext-diacriticscrepecrepecrêpe
retext-diacriticscruditescruditescrudités
retext-diacriticscuracaocuracaocuraçao
retext-diacriticsdebutantedebutantedébutante
retext-diacriticsdecordecordécor
retext-diacriticsdeja-vudeja vudéjà vu
retext-diacriticsdenouementdenouementdénouement
retext-diacriticsdoppelgangerdoppelgangerdoppelgänger
retext-diacriticsel-ninoel ninoel niño
retext-diacriticsemigreemigreémigré
retext-diacriticsfacadefacadefaçade
retext-diacriticsfiancefiancefiancé
retext-diacriticsfianceefianceefiancée
retext-diacriticsfilmjolkfilmjolkfilmjölk
retext-diacriticsflambeflambeflambé
retext-diacriticsfuhrerfuhrerführer
retext-diacriticsgarcongarcongarçon
retext-diacriticsgewurztraminergewurztraminergewürztraminer
retext-diacriticshaagen-dazshaagen dazshäagen-dazs
retext-diacriticshaagen-dazshaagen-dazshäagen-dazs
retext-diacriticsher-resumeher resumeher résumé
retext-diacriticshis-resumehis resumehis résumé
retext-diacriticsjalapenojalapenojalapeño
retext-diacriticsla-ninala ninala niña
retext-diacriticslowenbraulowenbraulöwenbräu
retext-diacriticslyceelyceelycée
retext-diacriticsmaitre-dmaitre dmaître d
retext-diacriticsmenage-a-troismenage a troisménage à trois
retext-diacriticsmonegasquemonegasquemonégasque
retext-diacriticsmotley-cruemotley cruemötley crüe
retext-diacriticsmy-resumemy resumemy résumé
retext-diacriticsnegligeenegligeenégligée
retext-diacriticsnescafenescafenescafé
retext-diacriticspaper-machepaper machepapier-mâché
retext-diacriticspaper-machepaper-machepapier-mâché
retext-diacriticspapier-machepapier-machepapier-mâché
retext-diacriticspina-coladapina coladapiña colada
retext-diacriticsprotegeprotegeprotégé
retext-diacriticsprotegeeprotegeeprotégée
retext-diacriticspureepureepurée
retext-diacriticsquebecquebecquébec
retext-diacriticsquebecoisquebecoisquébécois
retext-diacriticsqueensrychequeensrycheQueensrÿche
retext-diacriticsraison-d'etreraison d'etreraison d'être
retext-diacriticsrisquerisquerisqué
retext-diacriticsroueroueroué
retext-diacriticssenorsenorseñor
retext-diacriticssenorasenoraseñora
retext-diacriticssenoritasenoritaseñorita
retext-diacriticsskodaskodaŠkoda
retext-diacriticssmorgasbordsmorgasbordsmörgåsbord
retext-diacriticssoireesoireesoirée
retext-diacriticssoufflesoufflesoufflé
retext-diacriticssoupconsoupconsoupçon
retext-diacriticstete-a-tetetete-a-tetetête-à-tête
retext-diacriticsthe-resumethe resumethe résumé
retext-diacriticstouchetouchetouché
retext-diacriticsubermenschubermenschÜbermensch
retext-diacriticsvis-a-visvis-a-visvis-à-vis
retext-diacriticsvoilavoilavoilà
retext-diacriticsyour-resumeyour resumeyour résumé

The offending value is stored at message.actual, and the suggested values are stored at message.expected.

Types

This package is fully typed with TypeScript. It exports no additional types.

Compatibility

Projects maintained by the unified collective are compatible with all maintained versions of Node.js. As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+. Our projects sometimes work with older versions, but this is not guaranteed.

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