Skip to content

Commit cb9aed2

Browse files
committed
Add improved docs
1 parent 7b9f9e1 commit cb9aed2

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

lib/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import {convertElement} from 'hast-util-is-element'
1616
* Thing to check (typically `Node`).
1717
* @returns
1818
* Whether `value` is a script-supporting element.
19+
*
20+
* The elements `script` and `template` are script-supporting.
1921
*/
2022
// @ts-expect-error Sure, the assertion matches.
2123
export const scriptSupporting = convertElement(['script', 'template'])

readme.md

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

11-
[hast][] utility to check if a node is [*script-supporting*][spec].
11+
[hast][] utility to check if a node is a [*script-supporting* element][spec].
1212

1313
## Contents
1414

@@ -17,7 +17,7 @@
1717
* [Install](#install)
1818
* [Use](#use)
1919
* [API](#api)
20-
* [`scriptSupporting(node)`](#scriptsupportingnode)
20+
* [`scriptSupporting(value)`](#scriptsupportingvalue)
2121
* [Types](#types)
2222
* [Compatibility](#compatibility)
2323
* [Security](#security)
@@ -38,7 +38,7 @@ looking for!
3838
## Install
3939

4040
This package is [ESM only][esm].
41-
In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [npm][]:
41+
In Node.js (version 14.14+ and 16.0+), install with [npm][]:
4242

4343
```sh
4444
npm install hast-util-script-supporting
@@ -79,20 +79,22 @@ scriptSupporting({
7979

8080
## API
8181

82-
This package exports the identifier `scriptSupporting`.
82+
This package exports the identifier [`scriptSupporting`][scriptsupporting].
8383
There is no default export.
8484

85-
### `scriptSupporting(node)`
85+
### `scriptSupporting(value)`
8686

87-
Check if the given value is a [*script-supporting*][spec] [*element*][element].
87+
Check if the given value is a [*script-supporting* element][spec].
8888

8989
###### Parameters
9090

91-
* `node` ([`Node`][node]) — node to check
91+
* `value` (`unknown`) — thing to check (typically [`Node`][node])
9292

9393
###### Returns
9494

95-
Whether the `value` is script-supporting (`boolean`).
95+
Whether `value` is a script-supporting element (`boolean`).
96+
97+
The elements `script` and `template` are script-supporting.
9698

9799
## Types
98100

@@ -103,7 +105,7 @@ It exports no additional types.
103105

104106
Projects maintained by the unified collective are compatible with all maintained
105107
versions of Node.js.
106-
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
108+
As of now, that is Node.js 14.14+ and 16.0+.
107109
Our projects sometimes work with older versions, but this is not guaranteed.
108110

109111
## Security
@@ -206,12 +208,12 @@ abide by its terms.
206208

207209
[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
208210

209-
[spec]: https://html.spec.whatwg.org/#script-supporting-elements
211+
[spec]: https://html.spec.whatwg.org/multipage/dom.html#script-supporting-elements
210212

211213
[hast]: https://github.com/syntax-tree/hast
212214

213-
[element]: https://github.com/syntax-tree/hast#element
214-
215215
[node]: https://github.com/syntax-tree/hast#nodes
216216

217217
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
218+
219+
[scriptsupporting]: #scriptsupportingvalue

0 commit comments

Comments
 (0)