Skip to content

Commit bee6699

Browse files
committed
Add improved docs
1 parent cf188fc commit bee6699

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

readme.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ of something in a file.
3535
## Install
3636

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

4040
```sh
4141
npm install unist-util-source
@@ -44,14 +44,14 @@ npm install unist-util-source
4444
In Deno with [`esm.sh`][esmsh]:
4545

4646
```js
47-
import {source} from "https://esm.sh/unist-util-source@4"
47+
import {source} from 'https://esm.sh/unist-util-source@4'
4848
```
4949

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

5252
```html
5353
<script type="module">
54-
import {source} from "https://esm.sh/unist-util-source@4?bundle"
54+
import {source} from 'https://esm.sh/unist-util-source@4?bundle'
5555
</script>
5656
```
5757

@@ -86,7 +86,7 @@ console.log(source(strong, file))
8686

8787
## API
8888

89-
This package exports the identifier `source`.
89+
This package exports the identifier [`source`][source].
9090
There is no default export.
9191

9292
### `source(value, file)`
@@ -95,12 +95,14 @@ Get the source of a node or at a position.
9595

9696
###### Parameters
9797

98-
* `value` ([`Node`][node] or [`Position`][position]) — value to get
99-
* `file` ([`VFile`][vfile] or `string`) — file in which `value` exists
98+
* `value` ([`Node`][node] or [`Position`][position])
99+
— value to get
100+
* `file` ([`VFile`][vfile] or `string`)
101+
— file in which `value` exists
100102

101103
###### Returns
102104

103-
Source of `value` in `doc`, if available (`string?`).
105+
Source of `value` in `doc`, if available (`string` or `null`).
104106

105107
## Types
106108

@@ -111,7 +113,7 @@ It exports no additional types.
111113

112114
Projects maintained by the unified collective are compatible with all maintained
113115
versions of Node.js.
114-
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
116+
As of now, that is Node.js 14.14+ and 16.0+.
115117
Our projects sometimes work with older versions, but this is not guaranteed.
116118

117119
## Contribute
@@ -183,3 +185,5 @@ abide by its terms.
183185
[position]: https://github.com/syntax-tree/unist#position
184186

185187
[vfile]: https://github.com/vfile/vfile
188+
189+
[source]: #sourcevalue-file

0 commit comments

Comments
 (0)