Skip to content

Commit 0cec08b

Browse files
committed
Refactor docs
1 parent 006a657 commit 0cec08b

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

readme.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ This is used in [MDX][].
4747
## Install
4848

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

5252
```sh
5353
npm install hast-util-to-estree
@@ -95,9 +95,9 @@ Say our module `example.html` contains:
9595

9696
```js
9797
import fs from 'node:fs/promises'
98+
import {jsx, toJs} from 'estree-util-to-js'
9899
import {fromHtml} from 'hast-util-from-html'
99100
import {toEstree} from 'hast-util-to-estree'
100-
import {jsx, toJs} from 'estree-util-to-js'
101101

102102
const hast = fromHtml(await fs.readFile('example.html'))
103103

@@ -285,28 +285,28 @@ Info passed around about the current state (TypeScript type).
285285
286286
###### Fields
287287
288-
* `schema` ([`Schema`][schema])
289-
— current schema
288+
* `all` (`(node: HastParent) => EstreeJsxChild | undefined`)
289+
— transform children of a hast parent to estree
290+
* `comments` (`Array<EstreeComment>`)
291+
— list of estree comments
292+
* `createJsxAttributeName` (`(name: string) => EstreeJsxAttributeName`)
293+
— create a JSX attribute name
294+
* `createJsxElementName` (`(name: string) => EstreeJsxElementName`)
295+
— create a JSX attribute name
290296
* `elementAttributeNameCase`
291297
([`ElementAttributeNameCase`][api-element-attribute-name-case])
292298
— casing to use for attribute names
293-
* `comments` (`Array<EstreeComment>`)
294-
— list of estree comments
295299
* `esm` (`Array<EstreeNode>`)
296300
— list of top-level estree nodes
297301
* `handle` (`(node: HastNode) => EstreeJsxChild | undefined`)
298302
— transform a hast node to estree
299-
* `handle` (`(node: HastParent) => EstreeJsxChild | undefined`)
300-
— transform children of a hast parent to estree
301-
* `patch` (`(from: HastNode, to: EstreeNode) => undefined`)
302-
— take positional info from `from` (use `inherit` if you also want data)
303303
* `inherit` (`(from: HastNode, to: EstreeNode) => undefined`)
304304
— take positional info and data from `from` (use `patch` if you don’t want
305305
data)
306-
* `createJsxAttributeName` (`(name: string) => EstreeJsxAttributeName`)
307-
create a JSX attribute name
308-
* `createJsxElementName` (`(name: string) => EstreeJsxElementName`)
309-
create a JSX attribute name
306+
* `patch` (`(from: HastNode, to: EstreeNode) => undefined`)
307+
take positional info from `from` (use `inherit` if you also want data)
308+
* `schema` ([`Schema`][schema])
309+
current schema
310310
311311
### `StylePropertyNameCase`
312312
@@ -318,7 +318,7 @@ DOM casing is for example `backgroundColor` and `WebkitLineClamp`.
318318
###### Type
319319
320320
```ts
321-
type StylePropertyNameCase = 'dom' | 'css'
321+
type StylePropertyNameCase = 'css' | 'dom'
322322
```
323323
324324
## Types
@@ -332,10 +332,13 @@ It exports the additional types
332332
333333
## Compatibility
334334
335-
Projects maintained by the unified collective are compatible with all maintained
335+
Projects maintained by the unified collective are compatible with maintained
336336
versions of Node.js.
337-
As of now, that is Node.js 14.14+ and 16.0+.
338-
Our projects sometimes work with older versions, but this is not guaranteed.
337+
338+
When we cut a new major release, we drop support for unmaintained versions of
339+
Node.
340+
This means we try to keep the current release line, `hast-util-to-estree@^2`,
341+
compatible with Node.js 12.
339342
340343
## Security
341344
@@ -344,12 +347,12 @@ It’s not safe.
344347
345348
## Related
346349
350+
* [`estree-util-build-jsx`][build-jsx]
351+
— transform JSX to function calls
347352
* [`hastscript`][hastscript]
348353
— hyperscript compatible interface for creating nodes
349354
* [`hast-util-from-dom`](https://github.com/syntax-tree/hast-util-from-dom)
350355
— transform a DOM tree to hast
351-
* [`estree-util-build-jsx`][build-jsx]
352-
— transform JSX to function calls
353356
354357
## Contribute
355358
@@ -379,9 +382,9 @@ abide by its terms.
379382
380383
[downloads]: https://www.npmjs.com/package/hast-util-to-estree
381384
382-
[size-badge]: https://img.shields.io/bundlephobia/minzip/hast-util-to-estree.svg
385+
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=hast-util-to-estree
383386
384-
[size]: https://bundlephobia.com/result?p=hast-util-to-estree
387+
[size]: https://bundlejs.com/?q=hast-util-to-estree
385388
386389
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
387390

0 commit comments

Comments
 (0)