8
8
[ ![ Backers] [ backers-badge ]] [ collective ]
9
9
[ ![ Chat] [ chat-badge ]] [ chat ]
10
10
11
- [ ** hast** ] [ hast ] utility to check if a ` node ` is [ * inter-element
12
- whitespace* ] [ spec ] .
11
+ [ hast] [ ] utility to check if a node is [ * inter-element whitespace* ] [ spec ] .
13
12
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
+ * [ ` whitespace(node|value) ` ] ( #whitespacenodevalue )
21
+ * [ Types] ( #types )
22
+ * [ Compatibility] ( #compatibility )
23
+ * [ Security] ( #security )
24
+ * [ Related] ( #related )
25
+ * [ Contribute] ( #contribute )
26
+ * [ License] ( #license )
27
+
28
+ ## What is this?
15
29
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 whitespace according to
31
+ HTML .
18
32
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] [ ] :
20
42
21
43
``` sh
22
44
npm install hast-util-whitespace
23
45
```
24
46
47
+ In Deno with [ ` esm.sh ` ] [ esmsh ] :
48
+
49
+ ``` js
50
+ import {whitespace } from ' https://esm.sh/hast-util-whitespace@2'
51
+ ```
52
+
53
+ In browsers with [ ` esm.sh ` ] [ esmsh ] :
54
+
55
+ ``` html
56
+ <script type =" module" >
57
+ import {whitespace } from ' https://esm.sh/hast-util-whitespace@2?bundle'
58
+ </script >
59
+ ```
60
+
25
61
## Use
26
62
27
63
``` js
@@ -46,7 +82,7 @@ whitespace({
46
82
47
83
## API
48
84
49
- This package exports the following identifiers: ` whitespace ` .
85
+ This package exports the identifier ` whitespace ` .
50
86
There is no default export.
51
87
52
88
### ` whitespace(node|value) `
@@ -60,11 +96,23 @@ Check if the given value is [*inter-element whitespace*][spec].
60
96
61
97
###### Returns
62
98
63
- ` boolean ` — Whether the ` value ` is inter-element white-space : consisting of zero
99
+ Whether the ` value ` is inter-element whitespace ( ` boolean ` ) : consisting of zero
64
100
or more of space, tab (` \t ` ), line feed (` \n ` ), carriage return (` \r ` ), or form
65
101
feed (` \f ` ).
66
102
If ` node ` is passed it must be a [ * text* ] [ text ] node.
67
103
104
+ ## Types
105
+
106
+ This package is fully typed with [ TypeScript] [ ] .
107
+ It exports no additional types.
108
+
109
+ ## Compatibility
110
+
111
+ Projects maintained by the unified collective are compatible with all maintained
112
+ versions of Node.js.
113
+ As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
114
+ Our projects sometimes work with older versions, but this is not guaranteed.
115
+
68
116
## Security
69
117
70
118
` hast-util-whitespace ` does not change the syntax tree so there are no openings
@@ -92,21 +140,21 @@ for [cross-site scripting (XSS)][xss] attacks.
92
140
— check if a node is interactive
93
141
* [ ` hast-util-script-supporting ` ] ( https://github.com/syntax-tree/hast-util-script-supporting )
94
142
— check if a node is a script-supporting element
95
- * [ ` hast-util-is-body-ok-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-body-ok-link )
143
+ * [ ` hast-util-is-body-ok-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-body-ok-link )
96
144
— check if a node is “Body OK” link element
97
145
* [ ` hast-util-is-conditional-comment ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-conditional-comment )
98
146
— check if a node is a conditional comment
99
- * [ ` hast-util-is-css-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-css-link )
147
+ * [ ` hast-util-is-css-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-css-link )
100
148
— check if a node is a CSS link element
101
- * [ ` hast-util-is-css-style ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-css-style )
149
+ * [ ` hast-util-is-css-style ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-css-style )
102
150
— check if a node is a CSS style element
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 )
104
152
— check if a node is a JavaScript script element
105
153
106
154
## Contribute
107
155
108
- See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
109
- started.
156
+ See [ ` contributing.md ` ] [ contributing ] in [ ` syntax-tree/.github ` ] [ health ] for
157
+ ways to get started.
110
158
See [ ` support.md ` ] [ support ] for ways to get help.
111
159
112
160
This project has a [ code of conduct] [ coc ] .
@@ -147,15 +195,23 @@ abide by its terms.
147
195
148
196
[ npm ] : https://docs.npmjs.com/cli/install
149
197
198
+ [ esm ] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
199
+
200
+ [ esmsh ] : https://esm.sh
201
+
202
+ [ typescript ] : https://www.typescriptlang.org
203
+
150
204
[ license ] : license
151
205
152
206
[ author ] : https://wooorm.com
153
207
154
- [ contributing ] : https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
208
+ [ health ] : https://github.com/syntax-tree/.github
209
+
210
+ [ contributing ] : https://github.com/syntax-tree/.github/blob/main/contributing.md
155
211
156
- [ support ] : https://github.com/syntax-tree/.github/blob/HEAD /support.md
212
+ [ support ] : https://github.com/syntax-tree/.github/blob/main /support.md
157
213
158
- [ coc ] : https://github.com/syntax-tree/.github/blob/HEAD /code-of-conduct.md
214
+ [ coc ] : https://github.com/syntax-tree/.github/blob/main /code-of-conduct.md
159
215
160
216
[ hast ] : https://github.com/syntax-tree/hast
161
217
0 commit comments