8
8
9
9
** hast** is a specification for representing [ HTML] [ ] (and embedded [ SVG] [ ] or
10
10
[ MathML] [ ] ) as an abstract [ syntax tree] [ syntax-tree ] .
11
- It implements the [ ** unist** ] [ unist ] spec.
11
+ It implements the ** [ unist] [ ] ** spec.
12
12
13
13
This document may not be released.
14
14
See [ releases] [ ] for released documents.
@@ -79,8 +79,8 @@ interface Parent <: UnistParent {
79
79
}
80
80
```
81
81
82
- ** Parent** ([ ** UnistParent** ] [ dfn-unist-parent ] ) represents a node in hast
83
- containing other nodes (said to be [ * children* ] [ term-child ] ).
82
+ ** Parent** (** [ UnistParent] [ dfn-unist-parent ] ** ) represents a node in hast
83
+ containing other nodes (said to be * [ children] [ term-child ] * ).
84
84
85
85
Its content is limited to only other hast content.
86
86
@@ -92,7 +92,7 @@ interface Literal <: UnistLiteral {
92
92
}
93
93
```
94
94
95
- ** Literal** ([ ** UnistLiteral** ] [ dfn-unist-literal ] ) represents a node in hast
95
+ ** Literal** (** [ UnistLiteral] [ dfn-unist-literal ] ** ) represents a node in hast
96
96
containing a value.
97
97
98
98
### ` Root `
@@ -103,11 +103,11 @@ interface Root <: Parent {
103
103
}
104
104
```
105
105
106
- ** Root** ([ ** Parent** ] [ dfn-parent ] ) represents a document.
106
+ ** Root** (** [ Parent] [ dfn-parent ] ** ) represents a document.
107
107
108
- ** Root** can be used as the [ * root* ] [ term-root ] of a [ * tree* ] [ term-tree ] , or as
109
- a value of the ` content ` field on a ` 'template' ` [ ** Element** ] [ dfn-element ] ,
110
- never as a [ * child* ] [ term-child ] .
108
+ ** Root** can be used as the * [ root] [ term-root ] * of a * [ tree] [ term-tree ] * , or as
109
+ a value of the ` content ` field on a ` 'template' ` ** [ Element] [ dfn-element ] ** ,
110
+ never as a * [ child] [ term-child ] * .
111
111
112
112
### ` Element `
113
113
@@ -121,24 +121,24 @@ interface Element <: Parent {
121
121
}
122
122
```
123
123
124
- ** Element** ([ ** Parent** ] [ dfn-parent ] ) represents an [ Element] [ concept-element ]
124
+ ** Element** (** [ Parent] [ dfn-parent ] ** ) represents an [ Element] [ concept-element ]
125
125
([ \[ DOM\] ] [ dom ] ).
126
126
127
127
A ` tagName ` field must be present.
128
128
It represents the element’s [ local name] [ concept-local-name ] ([ \[ DOM\] ] [ dom ] ).
129
129
130
130
The ` properties ` field represents information associated with the element.
131
131
The value of the ` properties ` field implements the
132
- [ ** Properties** ] [ dfn-properties ] interface.
132
+ ** [ Properties] [ dfn-properties ] ** interface.
133
133
134
134
If the ` tagName ` field is ` 'template' ` , a ` content ` field can be present.
135
- The value of the ` content ` field implements the [ ** Root** ] [ dfn-root ] interface.
135
+ The value of the ` content ` field implements the ** [ Root] [ dfn-root ] ** interface.
136
136
137
137
If the ` tagName ` field is ` 'template' ` , the element must be a
138
- [ * leaf* ] [ term-leaf ] .
138
+ * [ leaf] [ term-leaf ] * .
139
139
140
- If the ` tagName ` field is ` 'noscript' ` , its [ * children* ] [ term-child ] should
141
- be represented as if [ * scripting is disabled* ] [ concept-scripting ]
140
+ If the ` tagName ` field is ` 'noscript' ` , its * [ children] [ term-child ] * should
141
+ be represented as if * [ scripting is disabled] [ concept-scripting ] *
142
142
([ \[ HTML\] ] [ html ] ).
143
143
144
144
For example, the following HTML:
@@ -170,16 +170,16 @@ interface Properties {}
170
170
171
171
** Properties** represents information associated with an element.
172
172
173
- Every field must be a [ ** PropertyName** ] [ dfn-property-name ] and every value a
174
- [ ** PropertyValue** ] [ dfn-property-value ] .
173
+ Every field must be a ** [ PropertyName] [ dfn-property-name ] ** and every value a
174
+ ** [ PropertyValue] [ dfn-property-value ] ** .
175
175
176
176
#### ` PropertyName `
177
177
178
178
``` idl
179
179
typedef string PropertyName
180
180
```
181
181
182
- Property names are keys on [ ** Properties** ] [ dfn-properties ] objects and reflect
182
+ Property names are keys on ** [ Properties] [ dfn-properties ] ** objects and reflect
183
183
HTML, SVG, ARIA, XML, XMLNS, or XLink attribute names.
184
184
Often, they have the same value as the corresponding attribute (for example,
185
185
` id ` is a property name reflecting the ` id ` attribute name), but there are some
@@ -292,7 +292,7 @@ interface Doctype <: Node {
292
292
}
293
293
```
294
294
295
- ** Doctype** ([ ** Node** ] [ dfn-unist-node ] ) represents a
295
+ ** Doctype** (** [ Node] [ dfn-unist-node ] ** ) represents a
296
296
[ DocumentType] [ concept-documenttype ] ([ \[ DOM\] ] [ dom ] ).
297
297
298
298
For example, the following HTML:
@@ -315,7 +315,7 @@ interface Comment <: Literal {
315
315
}
316
316
```
317
317
318
- ** Comment** ([ ** Literal** ] [ dfn-literal ] ) represents a [ Comment] [ concept-comment ]
318
+ ** Comment** (** [ Literal] [ dfn-literal ] ** ) represents a [ Comment] [ concept-comment ]
319
319
([ \[ DOM\] ] [ dom ] ).
320
320
321
321
For example, the following HTML:
@@ -338,7 +338,7 @@ interface Text <: Literal {
338
338
}
339
339
```
340
340
341
- ** Text** ([ ** Literal** ] [ dfn-literal ] ) represents a [ Text] [ concept-text ]
341
+ ** Text** (** [ Literal] [ dfn-literal ] ** ) represents a [ Text] [ concept-text ]
342
342
([ \[ DOM\] ] [ dom ] ).
343
343
344
344
For example, the following HTML:
@@ -373,101 +373,109 @@ The rest is sorted alphabetically based on content after `hast-util-`
373
373
-->
374
374
375
375
* [ ` hastscript ` ] ( https://github.com/syntax-tree/hastscript )
376
- — Hyperscript compatible DSL for creating nodes
376
+ — create trees
377
377
* [ ` hast-to-hyperscript ` ] ( https://github.com/syntax-tree/hast-to-hyperscript )
378
- — Convert a Node to React, Virtual DOM, Hyperscript, and more
378
+ — transform to something else through a hyperscript DSL
379
379
* [ ` hast-util-assert ` ] ( https://github.com/syntax-tree/hast-util-assert )
380
- — Assert hast nodes
380
+ — assert nodes
381
381
* [ ` hast-util-class-list ` ] ( https://github.com/shredsnews/hast-util-class-list )
382
- — Simulate the browser’s ` classList ` API for hast nodes
382
+ — simulate the browser’s ` classList ` API for hast nodes
383
383
* [ ` hast-util-classnames ` ] ( https://github.com/syntax-tree/hast-util-classnames )
384
- — Merge class names together
384
+ — merge class names together
385
385
* [ ` hast-util-embedded ` ] ( https://github.com/syntax-tree/hast-util-embedded )
386
- — Check if ` node ` is embedded content
386
+ — check if a node is an embedded element
387
+ * [ ` hast-util-excerpt ` ] ( https://github.com/syntax-tree/hast-util-excerpt )
388
+ — truncate the tree to a comment
387
389
* [ ` hast-util-find-and-replace ` ] ( https://github.com/syntax-tree/hast-util-find-and-replace )
388
- — Find and replace text
390
+ — find and replace text in a tree
389
391
* [ ` hast-util-from-dom ` ] ( https://github.com/syntax-tree/hast-util-from-dom )
390
- — Transform a DOM tree to hast
392
+ — transform from DOM tree
393
+ * [ ` hast-util-from-html ` ] ( https://github.com/syntax-tree/hast-util-from-html )
394
+ — parse from HTML
391
395
* [ ` hast-util-from-parse5 ` ] ( https://github.com/syntax-tree/hast-util-from-parse5 )
392
- — Transform Parse5’s AST to hast
396
+ — transform from Parse5’s AST
393
397
* [ ` hast-util-from-selector ` ] ( https://github.com/syntax-tree/hast-util-from-selector )
394
- — Create an element from a complex CSS selector
395
- * [ ` hast-util-from-string ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-from-string )
396
- — Set the plain-text value of a node (` textContent ` )
398
+ — parse CSS selectors to nodes
399
+ * [ ` hast-util-from-string ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-from-string )
400
+ — set the plain-text value of a node (` textContent ` )
397
401
* [ ` hast-util-from-text ` ] ( https://github.com/syntax-tree/hast-util-from-text )
398
- — Set the plain-text value of a node (` innerText ` )
402
+ — set the plain-text value of a node (` innerText ` )
399
403
* [ ` hast-util-from-webparser ` ] ( https://github.com/Prettyhtml/prettyhtml/tree/HEAD/packages/hast-util-from-webparser )
400
- — Transform Webparser’s AST to hast
404
+ — transform Webparser’s AST to hast
401
405
* [ ` hast-util-has-property ` ] ( https://github.com/syntax-tree/hast-util-has-property )
402
- — Check if a node has a property
406
+ — check if an element has a certain property
403
407
* [ ` hast-util-heading ` ] ( https://github.com/syntax-tree/hast-util-heading )
404
- — Check if a node is heading content
408
+ — check if a node is heading content
405
409
* [ ` hast-util-heading-rank ` ] ( https://github.com/syntax-tree/hast-util-heading-rank )
406
- — Get the rank (or depth, level) of headings
410
+ — get the rank (also known as depth or level) of headings
407
411
* [ ` hast-util-interactive ` ] ( https://github.com/syntax-tree/hast-util-interactive )
408
- — Check if a node is interactive
409
- * [ ` hast-util-is-body-ok-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-body-ok-link )
410
- — Check if a ` link ` element is “Body OK”
412
+ — check if a node is interactive
413
+ * [ ` hast-util-is-body-ok-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-body-ok-link )
414
+ — check if a ` link ` element is “Body OK”
411
415
* [ ` hast-util-is-conditional-comment ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-conditional-comment )
412
- — Check if ` node ` is a conditional comment
413
- * [ ` hast-util-is-css-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-css-link )
414
- — Check if ` node ` is a CSS ` link `
415
- * [ ` hast-util-is-css-style ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-css-style )
416
- — Check if ` node ` is a CSS ` style `
416
+ — check if ` node ` is a conditional comment
417
+ * [ ` hast-util-is-css-link ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-css-link )
418
+ — check if ` node ` is a CSS ` link `
419
+ * [ ` hast-util-is-css-style ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-css-style )
420
+ — check if ` node ` is a CSS ` style `
417
421
* [ ` hast-util-is-element ` ] ( https://github.com/syntax-tree/hast-util-is-element )
418
- — Check if ` node ` is a (certain) element
419
- * [ ` hast-util-is-event-handler ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-event-handler )
420
- — Check if ` property ` is an event handler
421
- * [ ` hast-util-is-javascript ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD /packages/hast-util-is-javascript )
422
- — Check if ` node ` is a JavaScript ` script `
422
+ — check if ` node ` is a (certain) element
423
+ * [ ` hast-util-is-event-handler ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-event-handler )
424
+ — check if ` property ` is an event handler
425
+ * [ ` hast-util-is-javascript ` ] ( https://github.com/rehypejs/rehype-minify/tree/main /packages/hast-util-is-javascript )
426
+ — check if ` node ` is a JavaScript ` script `
423
427
* [ ` hast-util-labelable ` ] ( https://github.com/syntax-tree/hast-util-labelable )
424
- — Check if ` node ` is labelable
428
+ — check if ` node ` is labelable
425
429
* [ ` hast-util-menu-state ` ] ( https://github.com/syntax-tree/hast-util-menu-state )
426
- — Check the state of a menu element
430
+ — check the state of a menu element
427
431
* [ ` hast-util-parse-selector ` ] ( https://github.com/syntax-tree/hast-util-parse-selector )
428
- — Create an element from a simple CSS selector
432
+ — create an element from a simple CSS selector
429
433
* [ ` hast-util-phrasing ` ] ( https://github.com/syntax-tree/hast-util-phrasing )
430
- — Check if a node is phrasing content
434
+ — check if a node is phrasing content
431
435
* [ ` hast-util-raw ` ] ( https://github.com/syntax-tree/hast-util-raw )
432
- — Reparse a hast tree
436
+ — parse a tree again
437
+ * [ ` hast-util-reading-time ` ] ( https://github.com/syntax-tree/hast-util-reading-time )
438
+ — estimate the reading time
433
439
* [ ` hast-util-sanitize ` ] ( https://github.com/syntax-tree/hast-util-sanitize )
434
- — Sanitise nodes
440
+ — sanitize nodes
435
441
* [ ` hast-util-script-supporting ` ] ( https://github.com/syntax-tree/hast-util-script-supporting )
436
- — Check if ` node ` is script-supporting content
442
+ — check if ` node ` is script-supporting content
437
443
* [ ` hast-util-select ` ] ( https://github.com/syntax-tree/hast-util-select )
438
444
— ` querySelector ` , ` querySelectorAll ` , and ` matches `
439
445
* [ ` hast-util-sectioning ` ] ( https://github.com/syntax-tree/hast-util-sectioning )
440
- — Check if ` node ` is sectioning content
446
+ — check if ` node ` is sectioning content
441
447
* [ ` hast-util-shift-heading ` ] ( https://github.com/syntax-tree/hast-util-shift-heading )
442
- — Change heading rank (depth, level)
448
+ — change heading rank (depth, level)
443
449
* [ ` hast-util-table-cell-style ` ] ( https://github.com/mapbox/hast-util-table-cell-style )
444
- — Transform deprecated styling attributes on table cells to inline styles
450
+ — transform deprecated styling attributes on table cells to inline styles
445
451
* [ ` hast-util-to-dom ` ] ( https://github.com/syntax-tree/hast-util-to-dom )
446
- — Transform to a DOM tree
452
+ — transform to a DOM tree
453
+ * [ ` hast-util-to-estree ` ] ( https://github.com/syntax-tree/hast-util-to-estree )
454
+ — transform to estree (JavaScript AST) JSX
447
455
* [ ` hast-util-to-html ` ] ( https://github.com/syntax-tree/hast-util-to-html )
448
- — Stringify nodes to HTML
456
+ — serialize as HTML
449
457
* [ ` hast-util-to-jsx ` ] ( https://github.com/mapbox/jsxtreme-markdown/tree/HEAD/packages/hast-util-to-jsx )
450
- — Transform hast to JSX
458
+ — transform hast to JSX
451
459
* [ ` hast-util-to-mdast ` ] ( https://github.com/syntax-tree/hast-util-to-mdast )
452
- — Transform hast to mdast (markdown)
460
+ — transform to mdast (markdown)
453
461
* [ ` hast-util-to-nlcst ` ] ( https://github.com/syntax-tree/hast-util-to-nlcst )
454
- — Transform hast to nlcst (natural language)
462
+ — transform to nlcst (natural language)
455
463
* [ ` hast-util-to-parse5 ` ] ( https://github.com/syntax-tree/hast-util-to-parse5 )
456
- — Transform hast to Parse5’s AST
464
+ — transform to Parse5’s AST
457
465
* [ ` hast-util-to-portable-text ` ] ( https://github.com/rexxars/hast-util-to-portable-text )
458
- — Transform hast to portable text
459
- * [ ` hast-util-to-snabbdom ` ] ( https://github.com/syntax-tree/hast-util-to-snabbdom )
460
- — Transform to a Snabbdom tree
466
+ — transform to portable text
461
467
* [ ` hast-util-to-string ` ] ( https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-to-string )
462
- — Get the plain-text value of a node (` textContent ` )
468
+ — get the plain-text value of a node (` textContent ` )
463
469
* [ ` hast-util-to-text ` ] ( https://github.com/syntax-tree/hast-util-to-text )
464
- — Get the plain-text value of a node (` innerText ` )
470
+ — get the plain-text value of a node (` innerText ` )
465
471
* [ ` hast-util-to-xast ` ] ( https://github.com/syntax-tree/hast-util-to-xast )
466
- — Transform hast to xast (xml)
472
+ — transform to xast (xml)
467
473
* [ ` hast-util-transparent ` ] ( https://github.com/syntax-tree/hast-util-transparent )
468
- — Check if ` node ` is transparent content
474
+ — check if ` node ` is transparent content
475
+ * [ ` hast-util-truncate ` ] ( https://github.com/syntax-tree/hast-util-truncate )
476
+ — truncate the tree to a certain number of characters
469
477
* [ ` hast-util-whitespace ` ] ( https://github.com/syntax-tree/hast-util-whitespace )
470
- — Check if ` node ` is inter-element whitespace
478
+ — check if ` node ` is inter-element whitespace
471
479
472
480
## Related HTML utilities
473
481
0 commit comments