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
- [ * embedded* ] [ spec ] .
11
+ [ hast] [ ] utility to check if a node is [ * embedded* ] [ 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
+ * [ ` embedded(node) ` ] ( #embeddednode )
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 embedded content
31
+ according to HTML.
15
32
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.
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
18
39
19
- [ 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] [ ] :
20
42
21
43
``` sh
22
44
npm install hast-util-embedded
23
45
```
24
46
47
+ In Deno with [ ` esm.sh ` ] [ esmsh ] :
48
+
49
+ ``` js
50
+ import {embedded } from ' https://esm.sh/hast-util-embedded@2'
51
+ ```
52
+
53
+ In browsers with [ ` esm.sh ` ] [ esmsh ] :
54
+
55
+ ``` html
56
+ <script type =" module" >
57
+ import {embedded } from ' https://esm.sh/hast-util-embedded@2?bundle'
58
+ </script >
59
+ ```
60
+
25
61
## Use
26
62
27
63
``` js
@@ -53,6 +89,26 @@ There is no default export.
53
89
54
90
Check if ` node ` is an [ * embedded* ] [ spec ] [ * element* ] [ element ] .
55
91
92
+ ###### Parameters
93
+
94
+ * ` node ` ([ ` Node ` ] [ node ] ) — node to check
95
+
96
+ ###### Returns
97
+
98
+ Whether ` node ` is embedded content (` boolean ` ).
99
+
100
+ ## Types
101
+
102
+ This package is fully typed with [ TypeScript] [ ] .
103
+ It exports no additional types.
104
+
105
+ ## Compatibility
106
+
107
+ Projects maintained by the unified collective are compatible with all maintained
108
+ versions of Node.js.
109
+ As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
110
+ Our projects sometimes work with older versions, but this is not guaranteed.
111
+
56
112
## Security
57
113
58
114
` hast-util-embedded ` does not change the syntax tree so there are no openings
@@ -64,19 +120,19 @@ for [cross-site scripting (XSS)][xss] attacks.
64
120
— check if a node is a (certain) element
65
121
* [ ` hast-util-has-property ` ] ( https://github.com/syntax-tree/hast-util-has-property )
66
122
— check if a node has a property
67
- * [ ` hast-util-is-body-ok-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-body-ok-link )
123
+ * [ ` hast-util-is-body-ok-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-body-ok-link )
68
124
— check if a node is “Body OK” link element
69
- * [ ` hast-util-is-conditional-comment ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-conditional-comment )
125
+ * [ ` hast-util-is-conditional-comment ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-conditional-comment )
70
126
— check if a node is a conditional comment
71
- * [ ` hast-util-is-css-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-css-link )
127
+ * [ ` hast-util-is-css-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-css-link )
72
128
— check if a node is a CSS link element
73
- * [ ` hast-util-is-css-style ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-css-style )
129
+ * [ ` hast-util-is-css-style ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-css-style )
74
130
— check if a node is a CSS style element
75
131
* [ ` hast-util-heading ` ] ( https://github.com/syntax-tree/hast-util-heading )
76
132
— check if a node is a heading element
77
133
* [ ` hast-util-interactive ` ] ( https://github.com/syntax-tree/hast-util-interactive )
78
134
— check if a node is interactive
79
- * [ ` hast-util-is-javascript ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-javascript )
135
+ * [ ` hast-util-is-javascript ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-javascript )
80
136
— check if a node is a JavaScript script element
81
137
* [ ` hast-util-labelable ` ] ( https://github.com/syntax-tree/hast-util-labelable )
82
138
— check whether a node is labelable
@@ -93,8 +149,8 @@ for [cross-site scripting (XSS)][xss] attacks.
93
149
94
150
## Contribute
95
151
96
- See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
97
- started.
152
+ See [ ` contributing.md ` ] [ contributing ] in [ ` syntax-tree/.github ` ] [ health ] for
153
+ ways to get started.
98
154
See [ ` support.md ` ] [ support ] for ways to get help.
99
155
100
156
This project has a [ code of conduct] [ coc ] .
@@ -135,20 +191,30 @@ abide by its terms.
135
191
136
192
[ npm ] : https://docs.npmjs.com/cli/install
137
193
194
+ [ esm ] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
195
+
196
+ [ esmsh ] : https://esm.sh
197
+
198
+ [ typescript ] : https://www.typescriptlang.org
199
+
138
200
[ license ] : license
139
201
140
202
[ author ] : https://wooorm.com
141
203
142
- [ contributing ] : https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
204
+ [ health ] : https://github.com/syntax-tree/.github
205
+
206
+ [ contributing ] : https://github.com/syntax-tree/.github/blob/main/contributing.md
143
207
144
- [ support ] : https://github.com/syntax-tree/.github/blob/HEAD /support.md
208
+ [ support ] : https://github.com/syntax-tree/.github/blob/main /support.md
145
209
146
- [ coc ] : https://github.com/syntax-tree/.github/blob/HEAD /code-of-conduct.md
210
+ [ coc ] : https://github.com/syntax-tree/.github/blob/main /code-of-conduct.md
147
211
148
212
[ spec ] : https://html.spec.whatwg.org/#embedded-content-2
149
213
150
214
[ hast ] : https://github.com/syntax-tree/hast
151
215
216
+ [ node ] : https://github.com/syntax-tree/hast#nodes
217
+
152
218
[ element ] : https://github.com/syntax-tree/hast#element
153
219
154
220
[ xss ] : https://en.wikipedia.org/wiki/Cross-site_scripting
0 commit comments