Skip to content

Commit abedfe3

Browse files
committed
Add improved docs
1 parent a6eeaea commit abedfe3

File tree

1 file changed

+68
-14
lines changed

1 file changed

+68
-14
lines changed

Diff for: readme.md

+68-14
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,51 @@
88
[![Backers][backers-badge]][collective]
99
[![Chat][chat-badge]][chat]
1010

11-
[**nlcst**][nlcst] utility to serialize a node.
11+
[nlcst][] utility to serialize a node.
1212

13-
## Install
13+
## Contents
14+
15+
* [What is this?](#what-is-this)
16+
* [When should I use this?](#when-should-i-use-this)
17+
* [Install](#install)
18+
* [Use](#use)
19+
* [API](#api)
20+
* [`toString(node[, separator])`](#tostringnode-separator)
21+
* [Types](#types)
22+
* [Compatibility](#compatibility)
23+
* [Contribute](#contribute)
24+
* [License](#license)
25+
26+
## What is this?
1427

15-
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c):
16-
Node 12+ is needed to use it and it must be `import`ed instead of `require`d.
28+
This package is a utility that takes [nlcst][] nodes and gets their plain-text
29+
value.
1730

18-
[npm][]:
31+
## When should I use this?
32+
33+
This is a small utility that is useful when you’re dealing with ASTs.
34+
35+
## Install
36+
37+
This package is [ESM only][esm].
38+
In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install with [npm][]:
1939

2040
```sh
21-
npm install nlcst-to-string
41+
npm install nlcst-util-to-string
42+
```
43+
44+
In Deno with [`esm.sh`][esmsh]:
45+
46+
```js
47+
import {toString} from "https://esm.sh/nlcst-util-to-string@3"
48+
```
49+
50+
In browsers with [`esm.sh`][esmsh]:
51+
52+
```html
53+
<script type="module">
54+
import {toString} from "https://esm.sh/nlcst-util-to-string@3?bundle"
55+
</script>
2256
```
2357

2458
## Use
@@ -40,7 +74,7 @@ console.log(
4074

4175
## API
4276

43-
This package exports the following identifiers: `toString`.
77+
This package exports the identifier `toString`.
4478
There is no default export.
4579

4680
### `toString(node[, separator])`
@@ -49,17 +83,29 @@ Stringify the given [nlcst][] node (or list of nodes).
4983

5084
###### Parameters
5185

52-
* `node` ([`Node`][node] or `Array<Node>`)
53-
* `separator` (`string`, default: `''`) — Value to delimit each item
86+
* `node` ([`Node`][node] or `Array<Node>`) — node to serialize.
87+
* `separator` (`string`, default: `''`) — value to delimit each item
5488

5589
###### Returns
5690

5791
`string`.
5892

93+
## Types
94+
95+
This package is fully typed with [TypeScript][].
96+
It exports no additional types.
97+
98+
## Compatibility
99+
100+
Projects maintained by the unified collective are compatible with all maintained
101+
versions of Node.js.
102+
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
103+
Our projects sometimes work with older versions, but this is not guaranteed.
104+
59105
## Contribute
60106

61-
See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get
62-
started.
107+
See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for
108+
ways to get started.
63109
See [`support.md`][support] for ways to get help.
64110

65111
This project has a [code of conduct][coc].
@@ -100,15 +146,23 @@ abide by its terms.
100146

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

149+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
150+
151+
[esmsh]: https://esm.sh
152+
153+
[typescript]: https://www.typescriptlang.org
154+
103155
[license]: license
104156

105157
[author]: https://wooorm.com
106158

107-
[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
159+
[health]: https://github.com/syntax-tree/.github
160+
161+
[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
108162

109-
[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md
163+
[support]: https://github.com/syntax-tree/.github/blob/main/support.md
110164

111-
[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
165+
[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
112166

113167
[nlcst]: https://github.com/syntax-tree/nlcst
114168

0 commit comments

Comments
 (0)