8
8
[ ![ Backers] [ backers-badge ]] [ collective ]
9
9
[ ![ Chat] [ chat-badge ]] [ chat ]
10
10
11
- [ ** hast** ] [ hast ] utility to check if an [ * element* ] [ element ] is
12
- [ * sectioning* ] [ spec ] .
11
+ [ hast] [ ] utility to check if a node is [ * sectioning* ] [ 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
+ * [ ` sectioning(node) ` ] ( #sectioningnode )
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 sectioning content
31
+ according to HTML.
32
+
33
+ ## When should I use this?
15
34
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.
35
+ This utility is super niche, if you’re here you probably know what you’re
36
+ looking for!
18
37
19
- [ npm] [ ] :
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-sectioning
23
45
```
24
46
47
+ In Deno with [ ` esm.sh ` ] [ esmsh ] :
48
+
49
+ ``` js
50
+ import {sectioning } from ' https://esm.sh/hast-util-sectioning@2'
51
+ ```
52
+
53
+ In browsers with [ ` esm.sh ` ] [ esmsh ] :
54
+
55
+ ``` html
56
+ <script type =" module" >
57
+ import {sectioning } from ' https://esm.sh/hast-util-sectioning@2?bundle'
58
+ </script >
59
+ ```
60
+
25
61
## Use
26
62
27
63
``` js
@@ -49,34 +85,59 @@ sectioning({
49
85
50
86
## API
51
87
52
- This package exports the following identifiers: ` sectioning ` .
88
+ This package exports the identifier ` sectioning ` .
53
89
There is no default export.
54
90
55
91
### ` sectioning(node) `
56
92
57
93
Check if the given value is a [ * sectioning* ] [ spec ] [ * element* ] [ element ] .
58
94
95
+ ###### Parameters
96
+
97
+ * ` node ` ([ ` Node ` ] [ node ] ) — node to check
98
+
99
+ ###### Returns
100
+
101
+ Whether ` node ` is sectioning content (` boolean ` ).
102
+
103
+ ## Types
104
+
105
+ This package is fully typed with [ TypeScript] [ ] .
106
+ It exports no additional types.
107
+
108
+ ## Compatibility
109
+
110
+ Projects maintained by the unified collective are compatible with all maintained
111
+ versions of Node.js.
112
+ As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
113
+ Our projects sometimes work with older versions, but this is not guaranteed.
114
+
115
+ ## Security
116
+
117
+ ` hast-util-sectioning ` does not change the syntax tree so there are no openings
118
+ for [ cross-site scripting (XSS)] [ xss ] attacks.
119
+
59
120
## Related
60
121
61
122
* [ ` hast-util-is-element ` ] ( https://github.com/syntax-tree/hast-util-is-element )
62
123
— check if a node is a (certain) element
63
124
* [ ` hast-util-has-property ` ] ( https://github.com/syntax-tree/hast-util-has-property )
64
125
— check if a node has a property
65
- * [ ` hast-util-is-body-ok-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-body-ok-link )
126
+ * [ ` hast-util-is-body-ok-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-body-ok-link )
66
127
— check if a node is “Body OK” link element
67
- * [ ` hast-util-is-conditional-comment ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-conditional-comment )
128
+ * [ ` hast-util-is-conditional-comment ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-conditional-comment )
68
129
— check if a node is a conditional comment
69
- * [ ` hast-util-is-css-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-css-link )
130
+ * [ ` hast-util-is-css-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-css-link )
70
131
— check if a node is a CSS link element
71
- * [ ` hast-util-is-css-style ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-css-style )
132
+ * [ ` hast-util-is-css-style ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-css-style )
72
133
— check if a node is a CSS style element
73
134
* [ ` hast-util-embedded ` ] ( https://github.com/syntax-tree/hast-util-embedded )
74
135
— check if a node is an embedded element
75
136
* [ ` hast-util-heading ` ] ( https://github.com/syntax-tree/hast-util-heading )
76
137
— check if a node is a heading element
77
138
* [ ` hast-util-interactive ` ] ( https://github.com/syntax-tree/hast-util-interactive )
78
139
— check if a node is interactive
79
- * [ ` hast-util-is-javascript ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-javascript )
140
+ * [ ` hast-util-is-javascript ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-javascript )
80
141
— check if a node is a JavaScript script element
81
142
* [ ` hast-util-labelable ` ] ( https://github.com/syntax-tree/hast-util-labelable )
82
143
— check whether a node is labelable
@@ -91,19 +152,14 @@ Check if the given value is a [*sectioning*][spec] [*element*][element].
91
152
92
153
## Contribute
93
154
94
- See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
95
- started.
155
+ See [ ` contributing.md ` ] [ contributing ] in [ ` syntax-tree/.github ` ] [ health ] for
156
+ ways to get started.
96
157
See [ ` support.md ` ] [ support ] for ways to get help.
97
158
98
159
This project has a [ code of conduct] [ coc ] .
99
160
By interacting with this repository, organization, or community you agree to
100
161
abide by its terms.
101
162
102
- ## Security
103
-
104
- ` hast-util-sectioning ` does not change the syntax tree so there are no openings
105
- for [ cross-site scripting (XSS)] [ xss ] attacks.
106
-
107
163
## License
108
164
109
165
[ MIT] [ license ] © [ Titus Wormer] [ author ]
@@ -138,18 +194,28 @@ for [cross-site scripting (XSS)][xss] attacks.
138
194
139
195
[ npm ] : https://docs.npmjs.com/cli/install
140
196
197
+ [ esm ] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
198
+
199
+ [ esmsh ] : https://esm.sh
200
+
201
+ [ typescript ] : https://www.typescriptlang.org
202
+
141
203
[ license ] : license
142
204
143
205
[ author ] : https://wooorm.com
144
206
145
- [ contributing ] : https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
207
+ [ health ] : https://github.com/syntax-tree/.github
146
208
147
- [ support ] : https://github.com/syntax-tree/.github/blob/HEAD/support .md
209
+ [ contributing ] : https://github.com/syntax-tree/.github/blob/main/contributing .md
148
210
149
- [ coc ] : https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
211
+ [ support ] : https://github.com/syntax-tree/.github/blob/main/support.md
212
+
213
+ [ coc ] : https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
150
214
151
215
[ hast ] : https://github.com/syntax-tree/hast
152
216
217
+ [ node ] : https://github.com/syntax-tree/hast#nodes
218
+
153
219
[ element ] : https://github.com/syntax-tree/hast#element
154
220
155
221
[ spec ] : https://html.spec.whatwg.org/#sectioning-content
0 commit comments