Skip to content

Commit 91ff915

Browse files
committed
Update docs
1 parent f1fb6b3 commit 91ff915

File tree

1 file changed

+82
-74
lines changed

1 file changed

+82
-74
lines changed

readme.md

Lines changed: 82 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
**hast** is a specification for representing [HTML][] (and embedded [SVG][] or
1010
[MathML][]) as an abstract [syntax tree][syntax-tree].
11-
It implements the [**unist**][unist] spec.
11+
It implements the **[unist][]** spec.
1212

1313
This document may not be released.
1414
See [releases][] for released documents.
@@ -79,8 +79,8 @@ interface Parent <: UnistParent {
7979
}
8080
```
8181

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]*).
8484

8585
Its content is limited to only other hast content.
8686

@@ -92,7 +92,7 @@ interface Literal <: UnistLiteral {
9292
}
9393
```
9494

95-
**Literal** ([**UnistLiteral**][dfn-unist-literal]) represents a node in hast
95+
**Literal** (**[UnistLiteral][dfn-unist-literal]**) represents a node in hast
9696
containing a value.
9797

9898
### `Root`
@@ -103,11 +103,11 @@ interface Root <: Parent {
103103
}
104104
```
105105

106-
**Root** ([**Parent**][dfn-parent]) represents a document.
106+
**Root** (**[Parent][dfn-parent]**) represents a document.
107107

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]*.
111111

112112
### `Element`
113113

@@ -121,24 +121,24 @@ interface Element <: Parent {
121121
}
122122
```
123123

124-
**Element** ([**Parent**][dfn-parent]) represents an [Element][concept-element]
124+
**Element** (**[Parent][dfn-parent]**) represents an [Element][concept-element]
125125
([\[DOM\]][dom]).
126126

127127
A `tagName` field must be present.
128128
It represents the element’s [local name][concept-local-name] ([\[DOM\]][dom]).
129129

130130
The `properties` field represents information associated with the element.
131131
The value of the `properties` field implements the
132-
[**Properties**][dfn-properties] interface.
132+
**[Properties][dfn-properties]** interface.
133133

134134
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.
136136

137137
If the `tagName` field is `'template'`, the element must be a
138-
[*leaf*][term-leaf].
138+
*[leaf][term-leaf]*.
139139

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]*
142142
([\[HTML\]][html]).
143143

144144
For example, the following HTML:
@@ -170,16 +170,16 @@ interface Properties {}
170170

171171
**Properties** represents information associated with an element.
172172

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]**.
175175

176176
#### `PropertyName`
177177

178178
```idl
179179
typedef string PropertyName
180180
```
181181

182-
Property names are keys on [**Properties**][dfn-properties] objects and reflect
182+
Property names are keys on **[Properties][dfn-properties]** objects and reflect
183183
HTML, SVG, ARIA, XML, XMLNS, or XLink attribute names.
184184
Often, they have the same value as the corresponding attribute (for example,
185185
`id` is a property name reflecting the `id` attribute name), but there are some
@@ -292,7 +292,7 @@ interface Doctype <: Node {
292292
}
293293
```
294294

295-
**Doctype** ([**Node**][dfn-unist-node]) represents a
295+
**Doctype** (**[Node][dfn-unist-node]**) represents a
296296
[DocumentType][concept-documenttype] ([\[DOM\]][dom]).
297297

298298
For example, the following HTML:
@@ -315,7 +315,7 @@ interface Comment <: Literal {
315315
}
316316
```
317317

318-
**Comment** ([**Literal**][dfn-literal]) represents a [Comment][concept-comment]
318+
**Comment** (**[Literal][dfn-literal]**) represents a [Comment][concept-comment]
319319
([\[DOM\]][dom]).
320320

321321
For example, the following HTML:
@@ -338,7 +338,7 @@ interface Text <: Literal {
338338
}
339339
```
340340

341-
**Text** ([**Literal**][dfn-literal]) represents a [Text][concept-text]
341+
**Text** (**[Literal][dfn-literal]**) represents a [Text][concept-text]
342342
([\[DOM\]][dom]).
343343

344344
For example, the following HTML:
@@ -373,101 +373,109 @@ The rest is sorted alphabetically based on content after `hast-util-`
373373
-->
374374

375375
* [`hastscript`](https://github.com/syntax-tree/hastscript)
376-
Hyperscript compatible DSL for creating nodes
376+
create trees
377377
* [`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
379379
* [`hast-util-assert`](https://github.com/syntax-tree/hast-util-assert)
380-
Assert hast nodes
380+
assert nodes
381381
* [`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
383383
* [`hast-util-classnames`](https://github.com/syntax-tree/hast-util-classnames)
384-
Merge class names together
384+
merge class names together
385385
* [`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
387389
* [`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
389391
* [`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
391395
* [`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
393397
* [`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`)
397401
* [`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`)
399403
* [`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
401405
* [`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
403407
* [`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
405409
* [`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
407411
* [`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”
411415
* [`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`
417421
* [`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`
423427
* [`hast-util-labelable`](https://github.com/syntax-tree/hast-util-labelable)
424-
Check if `node` is labelable
428+
check if `node` is labelable
425429
* [`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
427431
* [`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
429433
* [`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
431435
* [`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
433439
* [`hast-util-sanitize`](https://github.com/syntax-tree/hast-util-sanitize)
434-
Sanitise nodes
440+
sanitize nodes
435441
* [`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
437443
* [`hast-util-select`](https://github.com/syntax-tree/hast-util-select)
438444
`querySelector`, `querySelectorAll`, and `matches`
439445
* [`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
441447
* [`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)
443449
* [`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
445451
* [`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
447455
* [`hast-util-to-html`](https://github.com/syntax-tree/hast-util-to-html)
448-
Stringify nodes to HTML
456+
serialize as HTML
449457
* [`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
451459
* [`hast-util-to-mdast`](https://github.com/syntax-tree/hast-util-to-mdast)
452-
Transform hast to mdast (markdown)
460+
transform to mdast (markdown)
453461
* [`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)
455463
* [`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
457465
* [`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
461467
* [`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`)
463469
* [`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`)
465471
* [`hast-util-to-xast`](https://github.com/syntax-tree/hast-util-to-xast)
466-
Transform hast to xast (xml)
472+
transform to xast (xml)
467473
* [`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
469477
* [`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
471479

472480
## Related HTML utilities
473481

0 commit comments

Comments
 (0)