Home

Awesome

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 16+), install with npm:

npm install retext-diacritics

In Deno with esm.sh:

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

In browsers with esm.sh:

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

Use

Say our document example.txt contains:

Beyonce is the creme fresh on his resume.

…and our module example.js contains:

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

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

console.error(reporter(file))

…then running node example.js yields:

example.txt
1:1-1:8   warning Unexpected undiacritical `Beyonce`, did you mean `Beyoncé`           beyonce     retext-diacritics
1:16-1:27 warning Unexpected undiacritical `creme fresh`, did you mean `crème fraîche` creme-fresh retext-diacritics
1:31-1:41 warning Unexpected undiacritical `his resume`, did you mean `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.

Parameters

There are no parameters.

Returns

Transform (Transformer).

Messages

The following VFileMessages are used:

<!--messages start-->
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-diacriticstheir-resumetheir resumetheir résumé
retext-diacriticstouchetouchetouché
retext-diacriticsubermenschubermenschübermensch
retext-diacriticsvis-a-visvis-a-visvis-à-vis
retext-diacriticsvoilavoilavoilà
retext-diacriticsyour-resumeyour resumeyour résumé
<!--messages end-->

Types

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

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-diacritics@^5, 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

<!-- Definitions -->