Skip to content

Commit af2afcf

Browse files
committed
Add improved docs
1 parent 9929a95 commit af2afcf

File tree

1 file changed

+65
-12
lines changed

1 file changed

+65
-12
lines changed

readme.md

Lines changed: 65 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,54 @@
88
[![Backers][backers-badge]][collective]
99
[![Chat][chat-badge]][chat]
1010

11-
[**unist**][unist] utility to get a position from an [**estree**][estree] node.
11+
[unist][] utility to get a position from an [estree][] 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+
* [`positionFromEstree(node)`](#positionfromestreenode)
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 tiny utility that can create a proper unist position from
29+
an estree node
1730

18-
[npm][]:
31+
## When should I use this?
32+
33+
You can use this package when you want to use other unist utilities with estree
34+
nodes.
35+
36+
## Install
37+
38+
This package is [ESM only][esm].
39+
In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [npm][]:
1940

2041
```sh
2142
npm install unist-util-position-from-estree
2243
```
2344

45+
In Deno with [`esm.sh`][esmsh]:
46+
47+
```js
48+
import {positionFromEstree} from 'https://esm.sh/unist-util-position-from-estree@1'
49+
```
50+
51+
In browsers with [`esm.sh`][esmsh]:
52+
53+
```html
54+
<script type="module">
55+
import {positionFromEstree} from 'https://esm.sh/unist-util-position-from-estree@1?bundle'
56+
</script>
57+
```
58+
2459
## Use
2560

2661
```js
@@ -57,19 +92,29 @@ Yields:
5792

5893
## API
5994

60-
This package exports the following identifiers: `positionFromEstree`.
95+
This package exports the identifier `positionFromEstree`.
6196
There is no default export.
6297

6398
### `positionFromEstree(node)`
6499

65100
Given a [`node`][estree], returns a [`position`][position].
66101

67-
## Related
102+
## Types
103+
104+
This package is fully typed with [TypeScript][].
105+
It exports no additional types.
106+
107+
## Compatibility
108+
109+
Projects maintained by the unified collective are compatible with all maintained
110+
versions of Node.js.
111+
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
112+
Our projects sometimes work with older versions, but this is not guaranteed.
68113

69114
## Contribute
70115

71-
See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get
72-
started.
116+
See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for
117+
ways to get started.
73118
See [`support.md`][support] for ways to get help.
74119

75120
This project has a [code of conduct][coc].
@@ -110,15 +155,23 @@ abide by its terms.
110155

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

158+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
159+
160+
[esmsh]: https://esm.sh
161+
162+
[typescript]: https://www.typescriptlang.org
163+
113164
[license]: license
114165

115166
[author]: https://wooorm.com
116167

117-
[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
168+
[health]: https://github.com/syntax-tree/.github
169+
170+
[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
118171

119-
[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md
172+
[support]: https://github.com/syntax-tree/.github/blob/main/support.md
120173

121-
[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
174+
[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
122175

123176
[estree]: https://github.com/estree/estree
124177

0 commit comments

Comments
 (0)