Skip to content

Commit bfce642

Browse files
committed
Refactor docs
1 parent c6bd56c commit bfce642

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

readme.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The utility [`hast-util-from-html`][hast-util-from-html] wraps this utility and
4646
## Install
4747

4848
This package is [ESM only][esm].
49-
In Node.js (version 14.14+ and 16.0+), install with [npm][]:
49+
In Node.js (version 16+), install with [npm][]:
5050

5151
```sh
5252
npm install hast-util-from-parse5
@@ -77,10 +77,10 @@ Say our document `example.html` contains:
7777
…and our module `example.js` looks as follows:
7878

7979
```js
80+
import {fromParse5} from 'hast-util-from-parse5'
8081
import {parse} from 'parse5'
8182
import {read} from 'to-vfile'
8283
import {inspect} from 'unist-util-inspect'
83-
import {fromParse5} from 'hast-util-from-parse5'
8484

8585
const file = await read('example.html')
8686
const p5ast = parse(String(file), {sourceCodeLocationInfo: true})
@@ -94,9 +94,7 @@ console.log(inspect(hast))
9494
```text
9595
root[2] (1:1-2:1, 0-70)
9696
│ data: {"quirksMode":false}
97-
├─0 doctype<html> (1:1-1:16, 0-15)
98-
│ public: null
99-
│ system: null
97+
├─0 doctype (1:1-1:16, 0-15)
10098
└─1 element<html>[2]
10199
│ properties: {}
102100
├─0 element<head>[1]
@@ -115,7 +113,7 @@ root[2] (1:1-2:1, 0-70)
115113

116114
## API
117115

118-
This package exports the identifier [`fromParse5`][fromparse5].
116+
This package exports the identifier [`fromParse5`][api-from-parse5].
119117
There is no default export.
120118

121119
### `fromParse5(tree[, options])`
@@ -126,7 +124,7 @@ Transform a `parse5` AST to hast.
126124

127125
* `tree` ([`Parse5Node`][parse5-node])
128126
`parse5` tree to transform
129-
* `options` ([`Options`][options], optional)
127+
* `options` ([`Options`][api-options], optional)
130128
— configuration
131129

132130
###### Returns
@@ -139,20 +137,20 @@ Configuration (TypeScript type).
139137

140138
##### Fields
141139

140+
###### `file`
141+
142+
File used to add positional info to nodes ([`VFile`][vfile], optional).
143+
144+
If given, the file should represent the original HTML source.
145+
142146
###### `space`
143147

144-
Which space the document is in ([`Space`][space], default: `'html'`).
148+
Which space the document is in ([`Space`][api-space], default: `'html'`).
145149

146150
When an `<svg>` element is found in the HTML space, this package already
147151
automatically switches to and from the SVG space when entering and exiting
148152
it.
149153

150-
###### `file`
151-
152-
File used to add positional info to nodes ([`VFile`][vfile], optional).
153-
154-
If given, the file should represent the original HTML source.
155-
156154
###### `verbose`
157155

158156
Whether to add extra positional info about starting tags, closing tags,
@@ -217,14 +215,18 @@ type Space = 'html' | 'svg'
217215
## Types
218216
219217
This package is fully typed with [TypeScript][].
220-
It exports the additional types [`Options`][options] and [`Space`][space].
218+
It exports the additional types [`Options`][api-options] and
219+
[`Space`][api-space].
221220
222221
## Compatibility
223222
224-
Projects maintained by the unified collective are compatible with all maintained
223+
Projects maintained by the unified collective are compatible with maintained
225224
versions of Node.js.
226-
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
227-
Our projects sometimes work with older versions, but this is not guaranteed.
225+
226+
When we cut a new major release, we drop support for unmaintained versions of
227+
Node.
228+
This means we try to keep the current release line, `hast-util-from-parse5@^7`,
229+
compatible with Node.js 12.
228230
229231
## Security
230232
@@ -274,9 +276,9 @@ abide by its terms.
274276
275277
[downloads]: https://www.npmjs.com/package/hast-util-from-parse5
276278
277-
[size-badge]: https://img.shields.io/bundlephobia/minzip/hast-util-from-parse5.svg
279+
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=hast-util-from-parse5
278280
279-
[size]: https://bundlephobia.com/result?p=hast-util-from-parse5
281+
[size]: https://bundlejs.com/?q=hast-util-from-parse5
280282
281283
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
282284
@@ -324,8 +326,8 @@ abide by its terms.
324326
325327
[hast-node]: https://github.com/syntax-tree/hast#nodes
326328
327-
[fromparse5]: #fromparse5tree-options
329+
[api-from-parse5]: #fromparse5tree-options
328330
329-
[options]: #options
331+
[api-options]: #options
330332
331-
[space]: #space-1
333+
[api-space]: #space-1

0 commit comments

Comments
 (0)