Skip to content

Commit d72ee81

Browse files
committed
Add improved docs
1 parent e84342c commit d72ee81

File tree

1 file changed

+78
-19
lines changed

1 file changed

+78
-19
lines changed

readme.md

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

11-
[**hast**][hast] utility to check whether a node is [*interactive*][spec].
11+
[hast][] utility to check if a node is [*interactive*][spec].
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+
* [`interactive(node)`](#interactivenode)
21+
* [Types](#types)
22+
* [Compatibility](#compatibility)
23+
* [Security](#security)
24+
* [Related](#related)
25+
* [Contribute](#contribute)
26+
* [License](#license)
27+
28+
## What is this?
29+
30+
This package is a small utility that checks if a node is interactive content
31+
according to HTML.
32+
33+
## When should I use this?
34+
35+
This utility is super niche, if you’re here you probably know what you’re
36+
looking for!
1437

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.
38+
## Install
1739

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

2043
```sh
2144
npm install hast-util-interactive
2245
```
2346

47+
In Deno with [`esm.sh`][esmsh]:
48+
49+
```js
50+
import {interactive} from 'https://esm.sh/hast-util-interactive@2'
51+
```
52+
53+
In browsers with [`esm.sh`][esmsh]:
54+
55+
```html
56+
<script type="module">
57+
import {interactive} from 'https://esm.sh/hast-util-interactive@2?bundle'
58+
</script>
59+
```
60+
2461
## Use
2562

2663
```js
@@ -50,19 +87,33 @@ interactive({
5087

5188
## API
5289

53-
This package exports the following identifiers: `interactive`.
90+
This package exports the identifier `interactive`.
5491
There is no default export.
5592

5693
### `interactive(node)`
5794

95+
Check if the given value is [*interactive*][spec].
96+
5897
###### Parameters
5998

60-
* `node` ([`Node`][node], optional) — Node to check.
99+
* `node` ([`Node`][node], optional) — node to check
61100

62101
###### Returns
63102

64-
`boolean` — Whether `node` is an [`Element`][element] categorised as
65-
[*interactive*][spec].
103+
Whether `node` is an [`Element`][element] categorised as [*interactive*][spec]
104+
(`boolean`).
105+
106+
## Types
107+
108+
This package is fully typed with [TypeScript][].
109+
It exports no additional types.
110+
111+
## Compatibility
112+
113+
Projects maintained by the unified collective are compatible with all maintained
114+
versions of Node.js.
115+
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
116+
Our projects sometimes work with older versions, but this is not guaranteed.
66117

67118
## Security
68119

@@ -75,19 +126,19 @@ for [cross-site scripting (XSS)][xss] attacks.
75126
— check if a node is a (certain) element
76127
* [`hast-util-has-property`](https://github.com/syntax-tree/hast-util-has-property)
77128
— check if a node has a property
78-
* [`hast-util-is-body-ok-link`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-body-ok-link)
129+
* [`hast-util-is-body-ok-link`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-body-ok-link)
79130
— check if a node is “Body OK” link element
80-
* [`hast-util-is-conditional-comment`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-conditional-comment)
131+
* [`hast-util-is-conditional-comment`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-conditional-comment)
81132
— check if a node is a conditional comment
82-
* [`hast-util-is-css-link`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-css-link)
133+
* [`hast-util-is-css-link`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-css-link)
83134
— check if a node is a CSS link element
84-
* [`hast-util-is-css-style`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-css-style)
135+
* [`hast-util-is-css-style`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-css-style)
85136
— check if a node is a CSS style element
86137
* [`hast-util-embedded`](https://github.com/syntax-tree/hast-util-embedded)
87138
— check if a node is an embedded element
88139
* [`hast-util-heading`](https://github.com/syntax-tree/hast-util-heading)
89140
— check if a node is a heading element
90-
* [`hast-util-is-javascript`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-javascript)
141+
* [`hast-util-is-javascript`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-javascript)
91142
— check if a node is a JavaScript script element
92143
* [`hast-util-labelable`](https://github.com/syntax-tree/hast-util-labelable)
93144
— check whether a node is labelable
@@ -104,8 +155,8 @@ for [cross-site scripting (XSS)][xss] attacks.
104155

105156
## Contribute
106157

107-
See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get
108-
started.
158+
See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for
159+
ways to get started.
109160
See [`support.md`][support] for ways to get help.
110161

111162
This project has a [code of conduct][coc].
@@ -146,15 +197,23 @@ abide by its terms.
146197

147198
[npm]: https://docs.npmjs.com/cli/install
148199

200+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
201+
202+
[esmsh]: https://esm.sh
203+
204+
[typescript]: https://www.typescriptlang.org
205+
149206
[license]: license
150207

151208
[author]: https://wooorm.com
152209

153-
[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
210+
[health]: https://github.com/syntax-tree/.github
211+
212+
[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
154213

155-
[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md
214+
[support]: https://github.com/syntax-tree/.github/blob/main/support.md
156215

157-
[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
216+
[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
158217

159218
[hast]: https://github.com/syntax-tree/hast
160219

0 commit comments

Comments
 (0)