Skip to content

Commit 0e2b74d

Browse files
committed
Add improved docs
1 parent 1e094d1 commit 0e2b74d

File tree

1 file changed

+74
-18
lines changed

1 file changed

+74
-18
lines changed

readme.md

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

11-
[**hast**][hast] utility to check if a [*node*][node] is [*phrasing*][spec]
12-
content.
11+
[hast][] utility to check if a node is [*phrasing*][spec] content.
1312

14-
## 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+
* [`phrasing(node)`](#phrasingnode)
21+
* [Types](#types)
22+
* [Compatibility](#compatibility)
23+
* [Security](#security)
24+
* [Related](#related)
25+
* [Contribute](#contribute)
26+
* [License](#license)
27+
28+
## What is this?
1529

16-
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c):
17-
Node 12+ is needed to use it and it must be `import`ed instead of `require`d.
30+
This package is a small utility that checks if a node is phrasing content
31+
according to HTML.
1832

19-
[npm][]:
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!
37+
38+
## Install
39+
40+
This package is [ESM only][esm].
41+
In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [npm][]:
2042

2143
```sh
2244
npm install hast-util-phrasing
2345
```
2446

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

2763
```js
@@ -60,7 +96,7 @@ phrasing({type: 'text', value: 'Delta'})
6096

6197
## API
6298

63-
This package exports the following identifiers: `phrasing`.
99+
This package exports the identifier `phrasing`.
64100
There is no default export.
65101

66102
### `phrasing(node)`
@@ -73,7 +109,19 @@ Check if the given value is [*phrasing*][spec] content.
73109

74110
###### Returns
75111

76-
`boolean` — Whether `node` passes the test.
112+
Whether `node` passes the test (`boolean`).
113+
114+
## Types
115+
116+
This package is fully typed with [TypeScript][].
117+
It exports no additional types.
118+
119+
## Compatibility
120+
121+
Projects maintained by the unified collective are compatible with all maintained
122+
versions of Node.js.
123+
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
124+
Our projects sometimes work with older versions, but this is not guaranteed.
77125

78126
## Security
79127

@@ -86,21 +134,21 @@ for [cross-site scripting (XSS)][xss] attacks.
86134
— check if a node is a (certain) element
87135
* [`hast-util-has-property`](https://github.com/syntax-tree/hast-util-has-property)
88136
— check if a node has a property
89-
* [`hast-util-is-body-ok-link`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-body-ok-link)
137+
* [`hast-util-is-body-ok-link`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-body-ok-link)
90138
— check if a node is “Body OK” link element
91-
* [`hast-util-is-conditional-comment`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-conditional-comment)
139+
* [`hast-util-is-conditional-comment`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-conditional-comment)
92140
— check if a node is a conditional comment
93-
* [`hast-util-is-css-link`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-css-link)
141+
* [`hast-util-is-css-link`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-css-link)
94142
— check if a node is a CSS link element
95-
* [`hast-util-is-css-style`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-css-style)
143+
* [`hast-util-is-css-style`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-css-style)
96144
— check if a node is a CSS style element
97145
* [`hast-util-embedded`](https://github.com/syntax-tree/hast-util-embedded)
98146
— check if a node is an embedded element
99147
* [`hast-util-heading`](https://github.com/syntax-tree/hast-util-heading)
100148
— check if a node is a heading element
101149
* [`hast-util-interactive`](https://github.com/syntax-tree/hast-util-interactive)
102150
— check if a node is interactive
103-
* [`hast-util-is-javascript`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-javascript)
151+
* [`hast-util-is-javascript`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-javascript)
104152
— check if a node is a JavaScript script element
105153
* [`hast-util-labelable`](https://github.com/syntax-tree/hast-util-labelable)
106154
— check whether a node is labelable
@@ -115,8 +163,8 @@ for [cross-site scripting (XSS)][xss] attacks.
115163

116164
## Contribute
117165

118-
See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get
119-
started.
166+
See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for
167+
ways to get started.
120168
See [`support.md`][support] for ways to get help.
121169

122170
This project has a [code of conduct][coc].
@@ -157,15 +205,23 @@ abide by its terms.
157205

158206
[npm]: https://docs.npmjs.com/cli/install
159207

208+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
209+
210+
[esmsh]: https://esm.sh
211+
212+
[typescript]: https://www.typescriptlang.org
213+
160214
[license]: license
161215

162216
[author]: https://wooorm.com
163217

164-
[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
218+
[health]: https://github.com/syntax-tree/.github
219+
220+
[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
165221

166-
[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md
222+
[support]: https://github.com/syntax-tree/.github/blob/main/support.md
167223

168-
[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
224+
[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
169225

170226
[spec]: https://html.spec.whatwg.org/#phrasing-content-2
171227

0 commit comments

Comments
 (0)