diff --git a/package.json b/package.json index 8bf1005..24f3baf 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,10 @@ "remarkConfig": { "plugins": [ "remark-preset-wooorm", + [ + "remark-lint-no-html", + false + ], [ "remark-retext", false diff --git a/packages/retext-dutch/readme.md b/packages/retext-dutch/readme.md index c87361e..62f0404 100644 --- a/packages/retext-dutch/readme.md +++ b/packages/retext-dutch/readme.md @@ -18,7 +18,6 @@ * [Use](#use) * [API](#api) * [`unified().use(retextDutch)`](#unifieduseretextdutch) - * [`Parser`](#parser) * [Syntax tree](#syntax-tree) * [Types](#types) * [Compatibility](#compatibility) @@ -38,19 +37,17 @@ See [the monorepo readme][retext] for info on what the retext ecosystem is. ## When should I use this? This plugin adds support to unified for parsing Dutch. -You can alternatively use [`retext`][retext-core] instead, which combines -unified, this plugin, and [`retext-stringify`][retext-stringify]. -If the prose is in English, or any Latin-script language, use `unified` itself -with [`retext-english`][retext-english] or [`retext-latin`][retext-latin], -respectively. +If the prose is not Dutch, use [`retext`][retext-core] for any Latin-script +text, or for English use `unified` itself with +[`retext-english`][retext-english] and [`retext-stringify`][retext-stringify]. -This plugin is built on [`parse-dutch`][parse-dutch], which is a level lower, -but you could use that manually too. +If you just want the syntax tree, you can use [`parse-dutch`][parse-dutch] +directly. ## Install This package is [ESM only][esm]. -In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [npm][]: +In Node.js (version 16+), install with [npm][]: ```sh npm install retext-dutch @@ -73,10 +70,10 @@ In browsers with [`esm.sh`][esmsh]: ## Use ```js -import {reporter} from 'vfile-reporter' -import {unified} from 'unified' import retextDutch from 'retext-dutch' import retextStringify from 'retext-stringify' +import {unified} from 'unified' +import {reporter} from 'vfile-reporter' const file = await unified() .use(retextDutch) @@ -100,34 +97,39 @@ no issues found ## API -This package exports the identifier `Parser`. -The default export is `retextDutch`. +This package exports no identifiers. +The default export is [`retextDutch`][api-retext-dutch]. ### `unified().use(retextDutch)` -Add support for parsing Dutch input. +Add support for parsing Dutch natural language. + +###### Parameters -There are no options. +There are no parameters. -### `Parser` +###### Returns -Access to the [parser][] ([`parse-dutch`][parse-dutch]). +Nothing (`undefined`). ## Syntax tree -The syntax tree format used in retext is [nlcst][]. +The syntax tree used in retext is [nlcst][]. ## Types This package is fully typed with [TypeScript][]. -There are no extra exported types. +It exports no additional types. ## Compatibility -Projects maintained by the unified collective are compatible with all maintained +Projects maintained by the unified collective are compatible with 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. + +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-dutch@^4`, +compatible with Node.js 12. ## Contribute @@ -143,8 +145,6 @@ abide by its terms. Support this effort and give back by sponsoring on [OpenCollective][collective]! - -
@@ -262,22 +262,20 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]! [esmsh]: https://esm.sh -[typescript]: https://www.typescriptlang.org - -[unified]: https://github.com/unifiedjs/unified - -[retext]: https://github.com/retextjs/retext - [nlcst]: https://github.com/syntax-tree/nlcst -[parser]: https://github.com/unifiedjs/unified#processorparser - [parse-dutch]: https://github.com/wooorm/parse-dutch +[retext]: https://github.com/retextjs/retext + [retext-core]: https://github.com/retextjs/retext/tree/main/packages/retext +[retext-english]: https://github.com/retextjs/retext/tree/main/packages/retext-english + [retext-stringify]: https://github.com/retextjs/retext/tree/main/packages/retext-stringify -[retext-latin]: https://github.com/retextjs/retext/tree/main/packages/retext-latin +[typescript]: https://www.typescriptlang.org -[retext-english]: https://github.com/retextjs/retext/tree/main/packages/retext-english +[unified]: https://github.com/unifiedjs/unified + +[api-retext-dutch]: #unifieduseretextdutch diff --git a/packages/retext-english/readme.md b/packages/retext-english/readme.md index 6911b67..c0a12f7 100644 --- a/packages/retext-english/readme.md +++ b/packages/retext-english/readme.md @@ -18,7 +18,6 @@ * [Use](#use) * [API](#api) * [`unified().use(retextEnglish)`](#unifieduseretextenglish) - * [`Parser`](#parser) * [Syntax tree](#syntax-tree) * [Types](#types) * [Compatibility](#compatibility) @@ -38,19 +37,17 @@ See [the monorepo readme][retext] for info on what the retext ecosystem is. ## When should I use this? This plugin adds support to unified for parsing English. -You can alternatively use [`retext`][retext-core] instead, which combines -unified, this plugin, and [`retext-stringify`][retext-stringify]. -If the prose is in Dutch, or any Latin-script language, use `unified` itself -with [`retext-dutch`][retext-dutch] or [`retext-latin`][retext-latin], -respectively. +If the prose is not English, use [`retext`][retext-core] for any Latin-script +text, or for Dutch use `unified` itself with +[`retext-dutch`][retext-dutch] and [`retext-stringify`][retext-stringify]. -This plugin is built on [`parse-english`][parse-english], which is a level -lower, but you could use that manually too. +If you just want the syntax tree, you can use [`parse-english`][parse-english] +directly. ## Install This package is [ESM only][esm]. -In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [npm][]: +In Node.js (version 16+), install with [npm][]: ```sh npm install retext-english @@ -73,17 +70,17 @@ In browsers with [`esm.sh`][esmsh]: ## Use ```js -import {reporter} from 'vfile-reporter' -import {unified} from 'unified' import retextEnglish from 'retext-english' -import retextProfanities from 'retext-profanities' import retextEmoji from 'retext-emoji' +import retextProfanities from 'retext-profanities' import retextStringify from 'retext-stringify' +import {unified} from 'unified' +import {reporter} from 'vfile-reporter' const file = await unified() .use(retextEnglish) - .use(retextProfanities) .use(retextEmoji, {convert: 'encode'}) + .use(retextProfanities) .use(retextStringify) .process('He’s set on beating your butt for sheriff! :cop:') @@ -98,41 +95,46 @@ He’s set on beating your butt for sheriff! 👮 ``` ```txt - 1:26-1:30 warning Be careful with “butt”, it’s profane in some cases butt retext-profanities +1:26-1:30 warning Be careful with `butt`, it’s profane in some cases butt retext-profanities ⚠ 1 warning ``` ## API -This package exports the identifier `Parser`. -The default export is `retextEnglish`. +This package exports no identifiers. +The default export is [`retextEnglish`][api-retext-english]. ### `unified().use(retextEnglish)` -Add support for parsing English input. +Add support for parsing English natural language. + +###### Parameters -There are no options. +There are no parameters. -### `Parser` +###### Returns -Access to the [parser][] ([`parse-english`][parse-english]). +Nothing (`undefined`). ## Syntax tree -The syntax tree format used in retext is [nlcst][]. +The syntax tree used in retext is [nlcst][]. ## Types This package is fully typed with [TypeScript][]. -There are no extra exported types. +It exports no additional types. ## Compatibility -Projects maintained by the unified collective are compatible with all maintained +Projects maintained by the unified collective are compatible with 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. + +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-english@^4`, +compatible with Node.js 12. ## Contribute @@ -148,8 +150,6 @@ abide by its terms. Support this effort and give back by sponsoring on [OpenCollective][collective]! - -
@@ -267,22 +267,20 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]! [esmsh]: https://esm.sh -[typescript]: https://www.typescriptlang.org - -[unified]: https://github.com/unifiedjs/unified - -[retext]: https://github.com/retextjs/retext - [nlcst]: https://github.com/syntax-tree/nlcst -[parser]: https://github.com/unifiedjs/unified#processorparser - [parse-english]: https://github.com/wooorm/parse-english +[retext]: https://github.com/retextjs/retext + [retext-core]: https://github.com/retextjs/retext/tree/main/packages/retext [retext-stringify]: https://github.com/retextjs/retext/tree/main/packages/retext-stringify -[retext-latin]: https://github.com/retextjs/retext/tree/main/packages/retext-latin - [retext-dutch]: https://github.com/retextjs/retext/tree/main/packages/retext-dutch + +[typescript]: https://www.typescriptlang.org + +[unified]: https://github.com/unifiedjs/unified + +[api-retext-english]: #unifieduseretextenglish diff --git a/packages/retext-latin/readme.md b/packages/retext-latin/readme.md index 28c48c6..6acbed1 100644 --- a/packages/retext-latin/readme.md +++ b/packages/retext-latin/readme.md @@ -18,7 +18,6 @@ * [Use](#use) * [API](#api) * [`unified().use(retextLatin)`](#unifieduseretextlatin) - * [`Parser`](#parser) * [Syntax tree](#syntax-tree) * [Types](#types) * [Compatibility](#compatibility) @@ -37,20 +36,19 @@ See [the monorepo readme][retext] for info on what the retext ecosystem is. ## When should I use this? -This plugin adds support to unified for parsing Latin-script. -You can alternatively use [`retext`][retext-core] instead, which combines -unified, this plugin, and [`retext-stringify`][retext-stringify]. -If the prose is in English or Dutch, use `unified` itself with -[`retext-english`][retext-english] or [`retext-dutch`][retext-dutch], -respectively. +This plugin adds support to unified for parsing Latin-script natural language. +If the prose is English or Dutch, use `unified` itself with +[`retext-stringify`][retext-stringify] and either +[`retext-english`][retext-english] or [`retext-dutch`][retext-dutch]. +Or, use [`retext`][retext-core] directly. -This plugin is built on [`parse-latin`][parse-latin], which is a level lower, -but you could use that manually too. +If you just want the syntax tree, you can use [`parse-latin`][parse-latin] +directly. ## Install This package is [ESM only][esm]. -In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [npm][]: +In Node.js (version 16+), install with [npm][]: ```sh npm install retext-latin @@ -73,12 +71,12 @@ In browsers with [`esm.sh`][esmsh]: ## Use ```js -import {reporter} from 'vfile-reporter' -import {unified} from 'unified' +import retextEmoji from 'retext-emoji' import retextLatin from 'retext-latin' import retextProfanities from 'retext-profanities' -import retextEmoji from 'retext-emoji' import retextStringify from 'retext-stringify' +import {unified} from 'unified' +import {reporter} from 'vfile-reporter' const file = await unified() .use(retextLatin) @@ -98,41 +96,46 @@ He’s set on beating your butt for sheriff! 👮 ``` ```txt - 1:26-1:30 warning Be careful with “butt”, it’s profane in some cases butt retext-profanities +1:26-1:30 warning Be careful with `butt`, it’s profane in some cases butt retext-profanities ⚠ 1 warning ``` ## API -This package exports the identifier `Parser`. -The default export is `retextLatin`. +This package exports no identifiers. +The default export is [`retextLatin`][api-retext-latin]. ### `unified().use(retextLatin)` -Add support for parsing Latin-script input. +Add support for parsing Latin-script natural language. -There are no options. +###### Parameters -### `Parser` +There are no parameters. -Access to the [parser][] ([`parse-latin`][parse-latin]). +###### Returns + +Nothing (`undefined`). ## Syntax tree -The syntax tree format used in retext is [nlcst][]. +The syntax tree used in retext is [nlcst][]. ## Types This package is fully typed with [TypeScript][]. -There are no extra exported types. +It exports no additional types. ## Compatibility -Projects maintained by the unified collective are compatible with all maintained +Projects maintained by the unified collective are compatible with 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. + +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-latin@^3`, +compatible with Node.js 12. ## Contribute @@ -148,8 +151,6 @@ abide by its terms. Support this effort and give back by sponsoring on [OpenCollective][collective]! - -
@@ -267,22 +268,22 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]! [esmsh]: https://esm.sh -[typescript]: https://www.typescriptlang.org - -[unified]: https://github.com/unifiedjs/unified - [retext]: https://github.com/retextjs/retext [nlcst]: https://github.com/syntax-tree/nlcst -[parser]: https://github.com/unifiedjs/unified#processorparser - [parse-latin]: https://github.com/wooorm/parse-latin [retext-core]: https://github.com/retextjs/retext/tree/main/packages/retext -[retext-stringify]: https://github.com/retextjs/retext/tree/main/packages/retext-stringify +[retext-dutch]: https://github.com/retextjs/retext/tree/main/packages/retext-dutch [retext-english]: https://github.com/retextjs/retext/tree/main/packages/retext-english -[retext-dutch]: https://github.com/retextjs/retext/tree/main/packages/retext-dutch +[retext-stringify]: https://github.com/retextjs/retext/tree/main/packages/retext-stringify + +[typescript]: https://www.typescriptlang.org + +[unified]: https://github.com/unifiedjs/unified + +[api-retext-latin]: #unifieduseretextlatin diff --git a/packages/retext-stringify/readme.md b/packages/retext-stringify/readme.md index 47d1b06..976abbd 100644 --- a/packages/retext-stringify/readme.md +++ b/packages/retext-stringify/readme.md @@ -42,7 +42,7 @@ unified, [`retext-latin`][retext-latin], and this plugin. ## Install This package is [ESM only][esm]. -In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [npm][]: +In Node.js (version 16+), install with [npm][]: ```sh npm install retext-stringify @@ -65,15 +65,15 @@ In browsers with [`esm.sh`][esmsh]: ## Use ```js -import {reporter} from 'vfile-reporter' -import {unified} from 'unified' -import retextEnglish from 'retext-english' -import retextProfanities from 'retext-profanities' import retextEmoji from 'retext-emoji' +import retextLatin from 'retext-latin' +import retextProfanities from 'retext-profanities' import retextStringify from 'retext-stringify' +import {unified} from 'unified' +import {reporter} from 'vfile-reporter' const file = await unified() - .use(retextEnglish) + .use(retextLatin) .use(retextProfanities) .use(retextEmoji, {convert: 'encode'}) .use(retextStringify) @@ -90,7 +90,7 @@ He’s set on beating your butt for sheriff! 👮 ``` ```txt - 1:26-1:30 warning Be careful with “butt”, it’s profane in some cases butt retext-profanities +1:26-1:30 warning Be careful with `butt`, it’s profane in some cases butt retext-profanities ⚠ 1 warning ``` @@ -98,29 +98,38 @@ He’s set on beating your butt for sheriff! 👮 ## API This package exports no identifiers. -The default export is `retextStringify`. +The default export is [`retextStringify`][api-retext-stringify]. ### `unified().use(retextStringify)` Add support for serializing natural language. -There are no options. +###### Parameters + +There are no parameters. + +###### Returns + +Nothing (`undefined`). ## Syntax tree -The syntax tree format used in retext is [nlcst][]. +The syntax tree used in retext is [nlcst][]. ## Types This package is fully typed with [TypeScript][]. -There are no extra exported types. +It exports no additional types. ## Compatibility -Projects maintained by the unified collective are compatible with all maintained +Projects maintained by the unified collective are compatible with 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. + +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-stringify@^3`, +compatible with Node.js 12. ## Contribute @@ -136,8 +145,6 @@ abide by its terms. Support this effort and give back by sponsoring on [OpenCollective][collective]! - -
@@ -255,14 +262,16 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]! [esmsh]: https://esm.sh -[typescript]: https://www.typescriptlang.org - -[unified]: https://github.com/unifiedjs/unified +[nlcst]: https://github.com/syntax-tree/nlcst [retext]: https://github.com/retextjs/retext -[nlcst]: https://github.com/syntax-tree/nlcst - [retext-core]: https://github.com/retextjs/retext/tree/main/packages/retext [retext-latin]: https://github.com/retextjs/retext/tree/main/packages/retext-latin + +[typescript]: https://www.typescriptlang.org + +[unified]: https://github.com/unifiedjs/unified + +[api-retext-stringify]: #unifieduseretextstringify diff --git a/packages/retext/readme.md b/packages/retext/readme.md index 2c6f4f7..6735b76 100644 --- a/packages/retext/readme.md +++ b/packages/retext/readme.md @@ -8,8 +8,8 @@ [![Backers][backers-badge]][collective] [![Chat][chat-badge]][chat] -**[unified][]** processor with support for parsing Latin-script natural -language as input and serializing it as output. +**[unified][]** processor to add support for parsing and serializing +Latin-script natural language. ## Contents @@ -40,13 +40,13 @@ You can use this package when you want to use unified, have Latin-script as input, and as output. This package is a shortcut for `unified().use(retextLatin).use(retextStringify)`. -When the input isn’t Latin-script (meaning you don’t need `retext-latin`), it’s -recommended to use `unified` directly. +When the input isn’t Latin-script or is English or Dutch (meaning you don’t +need `retext-latin`), it’s recommended to use `unified` directly. ## Install This package is [ESM only][esm]. -In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [npm][]: +In Node.js (version 16+), install with [npm][]: ```sh npm install retext @@ -69,14 +69,14 @@ In browsers with [`esm.sh`][esmsh]: ## Use ```js -import {reporter} from 'vfile-reporter' import {retext} from 'retext' -import retextProfanities from 'retext-profanities' import retextEmoji from 'retext-emoji' +import retextProfanities from 'retext-profanities' +import {reporter} from 'vfile-reporter' const file = await retext() - .use(retextProfanities) .use(retextEmoji, {convert: 'encode'}) + .use(retextProfanities) .process('He’s set on beating your butt for sheriff! :cop:') console.log(String(file)) @@ -90,37 +90,42 @@ He’s set on beating your butt for sheriff! 👮 ``` ```txt - 1:26-1:30 warning Be careful with “butt”, it’s profane in some cases butt retext-profanities +1:26-1:30 warning Be careful with `butt`, it’s profane in some cases butt retext-profanities ⚠ 1 warning ``` ## API -This package exports the identifier `retext`. +This package exports the identifier [`retext`][api-retext]. There is no default export. ### `retext()` -Create a new (unfrozen) unified processor that already uses `retext-latin` and -`retext-stringify` and you can add more plugins to. +Create a new unified processor that already uses +[`retext-latin`][retext-latin] and [`retext-stringify`][retext-stringify]. + +You can add more plugins with `use`. See [`unified`][unified] for more information. ## Syntax tree -The syntax tree format used in retext is [nlcst][]. +The syntax tree used in retext is [nlcst][]. ## Types This package is fully typed with [TypeScript][]. -There are no extra exported types. +It exports no additional types. ## Compatibility -Projects maintained by the unified collective are compatible with all maintained +Projects maintained by the unified collective are compatible with 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. + +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@^8`, compatible +with Node.js 12. ## Contribute @@ -136,8 +141,6 @@ abide by its terms. Support this effort and give back by sponsoring on [OpenCollective][collective]! - -
@@ -223,9 +226,9 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]! [downloads]: https://www.npmjs.com/package/retext -[size-badge]: https://img.shields.io/bundlephobia/minzip/retext.svg +[size-badge]: https://img.shields.io/bundlejs/size/retext -[size]: https://bundlephobia.com/result?p=retext +[size]: https://bundlejs.com/?q=retext [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg @@ -255,9 +258,7 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]! [esmsh]: https://esm.sh -[typescript]: https://www.typescriptlang.org - -[unified]: https://github.com/unifiedjs/unified +[nlcst]: https://github.com/syntax-tree/nlcst [retext-latin]: https://github.com/retextjs/retext/tree/main/packages/retext-latin @@ -265,4 +266,8 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]! [retext]: https://github.com/retextjs/retext -[nlcst]: https://github.com/syntax-tree/nlcst +[typescript]: https://www.typescriptlang.org + +[unified]: https://github.com/unifiedjs/unified + +[api-retext]: #retext-1 diff --git a/readme.md b/readme.md index 73016e2..9a24b7a 100644 --- a/readme.md +++ b/readme.md @@ -15,8 +15,8 @@ You can use retext on the server, the client, deno, etc. ## Intro retext is an ecosystem of plugins that work with natural language as structured -data, specifically ASTs (abstract syntax trees). -ASTs make it easy for programs to deal with prose. +data, specifically CSTs (concrete syntax trees). +Syntax trees make it easy for programs to deal with prose. We call those programs plugins. Plugins inspect and change trees. You can use the many existing plugins or you can make your own. @@ -42,37 +42,75 @@ Some example use cases are to [check spelling][retext-spell], ## What is this? -You can use plugins to fix typography. -**In**: +With this project and a plugin, you can turn simple punctuation: ```text He said, "A 'simple' english sentence. . . ``` -**Out**: +…into smart punctuation: ```text He said, “A ‘simple’ english sentence…” ``` -You can use plugins to check natural language. +
Show example code + +```js +import retextLatin from 'retext-latin' +import retextSmartyPants from 'retext-smartypants' +import retextStringify from 'retext-stringify' +import {unified} from 'unified' + +const file = await unified() + .use(retextLatin) + .use(retextSmartyPants) + .use(retextStringify) + .process("He said, \"A 'simple' english sentence. . .") + +console.log(String(file)) +``` + +
+ +With another plugin, you can check natural language: + **In**: ```text -He’s pretty set on beating your butt for sheriff. +Where can I find an ATM machine? ``` **Out**: ```text -example.txt - 1:1-1:5 warning `He’s` may be insensitive, use `They`, `It` instead he-she retext-equality - 1:33-1:37 warning Be careful with “butt”, it’s profane in some cases butt retext-profanities +1:21-1:32 warning Expected `ATM` instead of `ATM machine` atm retext-redundant-acronyms ⚠ 1 warning ``` -And you can make your own plugins. +
Show example code + +```js +import retextEnglish from 'retext-english' +import retextRedundantAcronyms from 'retext-redundant-acronyms' +import retextStringify from 'retext-stringify' +import {unified} from 'unified' +import {reporter} from 'vfile-reporter' + +const file = await unified() + .use(retextEnglish) + .use(retextRedundantAcronyms) + .use(retextStringify) + .process('Where can I find an ATM machine?') + +console.log(reporter(file)) +``` + +
+ +…and you can make your own plugins. + You can use retext for many different things. **[unified][]** is the core project that transforms content with ASTs. **retext** adds support for natural language to unified. @@ -80,10 +118,10 @@ You can use retext for many different things. This GitHub repository is a monorepo that contains the following packages: -* [`retext-english`][retext-english] - — parse English prose to a syntax tree * [`retext-dutch`][retext-dutch] — parse Dutch prose to a syntax tree +* [`retext-english`][retext-english] + — parse English prose to a syntax tree * [`retext-latin`][retext-latin] — parse any Latin-script prose to a syntax tree * [`retext-stringify`][retext-stringify] @@ -122,37 +160,52 @@ The retext organization and the unified collective as a whole is fully typed with [TypeScript][]. Types for nlcst are available in [`@types/nlcst`][types-nlcst]. -For TypeScript to work, it is particularly important to type your plugins -correctly. -We strongly recommend using the `Plugin` type from `unified` with its generics -and to use the node types for the syntax trees provided by `@types/nlcst`. +For TypeScript to work, it is important to type your plugins. +For example: ```js /** * @typedef {import('nlcst').Root} Root - * + */ + +/** * @typedef Options * Configuration (optional). - * @property {boolean} [someField] + * @property {boolean | null | undefined} [someField] * Some option. */ -// To type options and that the it works with `nlcst`: -/** @type {import('unified').Plugin<[Options?], Root>} */ +/** + * My plugin. + * + * @param {Options | null | undefined} [options] + * Configuration (optional). + * @returns + * Transform. + */ export function myRetextPluginAcceptingOptions(options) { - // `options` is `Options?`. + /** + * @param {Root} tree + * Tree. + * @param {VFile} file + * File. + * @returns {undefined} + * Nothing. + */ return function (tree, file) { - // `tree` is `Root`. + // Do things. } } ``` ## Compatibility -Projects maintained by the unified collective are compatible with all maintained +Projects maintained by the unified collective are compatible with 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. + +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 compatible with Node.js 12. ## Contribute @@ -171,8 +224,6 @@ For info on how to submit a security report, see our Support this effort and give back by sponsoring on [OpenCollective][collective]! - -
@@ -260,9 +311,9 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]! [downloads]: https://www.npmjs.com/package/retext -[size-badge]: https://img.shields.io/bundlephobia/minzip/retext.svg +[size-badge]: https://img.shields.io/bundlejs/size/retext -[size]: https://bundlephobia.com/result?p=retext +[size]: https://bundlejs.com/?q=retext [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg @@ -316,11 +367,11 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]! [list-of-plugins]: https://github.com/retextjs/retext/tree/main/doc/plugins.md -[retext-spell]: https://github.com/retextjs/retext-spell +[retext-readability]: https://github.com/retextjs/retext-readability [retext-smartypants]: https://github.com/retextjs/retext-smartypants -[retext-readability]: https://github.com/retextjs/retext-readability +[retext-spell]: https://github.com/retextjs/retext-spell [contribute]: #contribute