Skip to content

Commit

Permalink
Add improved docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jun 25, 2022
1 parent 1922fec commit b31c637
Show file tree
Hide file tree
Showing 7 changed files with 885 additions and 372 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
},
"scripts": {
"build": "npm run build --workspaces && rimraf \"*.d.ts\" && tsc && type-coverage",
"todo": "remark -qfo && ",
"format": "prettier . -w --loglevel warn && xo --fix",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"test-api": "node --conditions development test.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node --conditions development test.js",
"test": "npm run build && npm run format && npm run test-coverage"
Expand Down
209 changes: 145 additions & 64 deletions packages/retext-dutch/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,138 @@
[![Backers][backers-badge]][collective]
[![Chat][chat-badge]][chat]

[**retext**][retext] plugin to parse Dutch natural language.
[Parser][] for [**unified**][unified].
Parses Dutch language prose to [**nlcst**][nlcst] syntax trees.
**[retext][]** plugin to add support for parsing Dutch natural language.

## Sponsors
## Contents

* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`unified().use(retextDutch)`](#unifieduseretextdutch)
* [`Parser`](#parser)
* [Syntax tree](#syntax-tree)
* [Types](#types)
* [Compatibility](#compatibility)
* [Contribute](#contribute)
* [Sponsor](#sponsor)
* [License](#license)

## What is this?

This package is a [unified][] ([retext][]) plugin that defines how to take
Dutch natural language as input and turn it into a syntax tree.
When it’s used, natural language can be parsed and other retext plugins can be
used after it.

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.

This plugin is built on [`parse-dutch`][parse-dutch], which is a level lower,
but you could use that manually too.

## Install

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

```sh
npm install retext-dutch
```

In Deno with [`esm.sh`][esmsh]:

```js
import retextDutch from 'https://esm.sh/retext-dutch@4'
```

In browsers with [`esm.sh`][esmsh]:

```html
<script type="module">
import retextDutch from 'https://esm.sh/retext-dutch@4?bundle'
</script>
```

## Use

```js
import {reporter} from 'vfile-reporter'
import {unified} from 'unified'
import retextDutch from 'retext-dutch'
import retextStringify from 'retext-stringify'

const file = await unified()
.use(retextDutch)
// Add your own plugins that work with Dutch here!
.use(retextStringify)
.process('Kunt U zich ’s morgens melden bij het afd. hoofd dhr. Venema')

console.log(String(file))
console.error(reporter(file))
```

Yields:

```txt
Kunt U zich ’s morgens melden bij het afd. hoofd dhr. Venema
```

```txt
no issues found
```

## API

This package exports the identifier `Parser`.
The default export is `retextDutch`.

### `unified().use(retextDutch)`

Add support for parsing Dutch input.

There are no options.

### `Parser`

Access to the [parser][] ([`parse-dutch`][parse-dutch]).

## Syntax tree

The syntax tree format used in retext is [nlcst][].

## Types

This package is fully typed with [TypeScript][].
There are no extra exported 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`][contributing] in [`retextjs/.github`][health] for ways
to get started.
See [`support.md`][support] for ways to get help.

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

## Sponsor

Support this effort and give back by sponsoring on [OpenCollective][collective]!

Expand Down Expand Up @@ -82,62 +209,6 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
</tr>
</table>

## Install

This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c):
Node 12+ is needed to use it and it must be `import`ed instead of `require`d.

[npm][]:

```sh
npm install retext-dutch
```

## Use

```js
import {unified} from 'unified'
import {stream} from 'unified-stream'
import retextDutch from 'retext-dutch'
import retextStringify from 'retext-stringify'
import retextEmoji from 'retext-emoji'

const processor = unified()
.use(retextDutch)
.use(retextEmoji, {convert: 'encode'})
.use(retextStringify)

process.stdin.pipe(stream(processor)).pipe(process.stdout)
```

## API

This package exports the following identifiers: `Parser`.
`retextDutch` is the default export.

### `unified().use(retextDutch)`

Parse Dutch natural language.
There is no configuration for the parser.

### `Parser`

Access to the [parser][] ([`parse-dutch`][parse-dutch]).

## Contribute

See [`contributing.md`][contributing] in [`retextjs/.github`][health] for ways
to get started.
See [`support.md`][support] for ways to get help.
Ideas for new plugins and tools can be posted in [`retextjs/ideas`][ideas].

A curated list of awesome retext resources can be found in [**awesome
retext**][awesome].

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

## License

[MIT][license] © [Titus Wormer][author]
Expand Down Expand Up @@ -178,16 +249,18 @@ abide by its terms.

[coc]: https://github.com/retextjs/.github/blob/main/code-of-conduct.md

[ideas]: https://github.com/retextjs/ideas

[awesome]: https://github.com/retextjs/awesome-retext

[license]: https://github.com/retextjs/retext/blob/main/license

[author]: https://wooorm.com

[npm]: https://docs.npmjs.com/cli/install

[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

[esmsh]: https://esm.sh

[typescript]: https://www.typescriptlang.org

[unified]: https://github.com/unifiedjs/unified

[retext]: https://github.com/retextjs/retext
Expand All @@ -197,3 +270,11 @@ abide by its terms.
[parser]: https://github.com/unifiedjs/unified#processorparser

[parse-dutch]: https://github.com/wooorm/parse-dutch

[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-english]: https://github.com/retextjs/retext/tree/main/packages/retext-english
Loading

0 comments on commit b31c637

Please sign in to comment.