8
8
are the summation of at least [ two] [ first-retext-commit ]
9
9
[ years] [ first-remark-commit ] of my work and the current epitome of that.
10
10
11
- It’s basically a system for processing input: parsing it into a syntax tree,
12
- transforming it by plug-ins, and compiling the tree to something else.
11
+ It’s a system for processing input: parsing it into a syntax tree,
12
+ transforming it through plug-ins, and compiling the tree to something
13
+ else.
13
14
14
15
This document explains some terminology relating to [ ** retext** ] [ retext ] ,
15
16
[ ** remark** ] [ remark ] , [ ** hast** ] [ hast ] , and their related projects.
16
17
17
- This document describes version 1.0.0 of Unist.
18
- [ Changelog » ] [ changelog ] .
18
+ This document may not be released. See [ releases ] [ ] for released
19
+ documents .
19
20
20
21
## Unist nodes
21
22
22
- See [ ** nlcst** ] [ nlcst ] for more information on ** retext** nodes,
23
- [ ** mdast** ] [ mdast ] for information on ** remark** nodes, and
24
- [ ` hast#nodes ` ] [ hast-nodes ] for information on ** hast** nodes.
25
-
26
23
Subsets of Unist can define new properties on new nodes, and plug-ins
27
24
and utilities can define new [ ` data ` ] [ data ] properties on nodes. But,
28
25
the values on those properties ** must** be JSON values: ` string ` ,
@@ -32,16 +29,20 @@ and produce the same tree. For example, in JavaScript, a tree should
32
29
be able to be passed through ` JSON.parse(JSON.stringify(tree)) ` and
33
30
result in the same values.
34
31
32
+ See [ ** nlcst** ] [ nlcst ] for more information on ** retext** nodes,
33
+ [ ** mdast** ] [ mdast ] for information on ** remark** nodes, and
34
+ [ ** hast** ] [ hast ] for information on ** hast** nodes.
35
+
35
36
### ` Node `
36
37
37
- Node represents any unit in the Unist hierarchy. It is an abstract
38
- class . Interfaces inheriting from ** Node** must have a ` type ` property,
39
- and may have ` data ` or ` location ` properties. ` type ` s are defined by
38
+ A Node represents any unit in the Unist hierarchy. It is an abstract
39
+ interface . Interfaces extending ** Node** must have a ` type ` property,
40
+ and may have ` data ` or ` location ` properties. ` type ` s are defined by
40
41
their namespace.
41
42
42
43
Subsets of Unist are allowed to define properties on interfaces which
43
- subclass Unist’s abstract interfaces. For example, [ mdast] [ ] defines
44
- a ` link ` node (subclassing [ Parent] [ ] ) with a ` url ` property.
44
+ extend Unist’s abstract interfaces. For example, [ mdast] [ ] defines
45
+ ** Link ** ( [ Parent] [ ] ) with a ` url ` property.
45
46
46
47
``` idl
47
48
interface Node {
@@ -64,13 +65,13 @@ interface Data { }
64
65
65
66
#### ` Location `
66
67
67
- ** Location** references a location of a node in a ** Unist** file.
68
- ** Location** consists of a ` start ` and ` end ` position. And, if
69
- relevant, an ` indent ` property.
68
+ ** Location** references a range consisting of two points in a [ Unist
69
+ file ] [ file ] . ** Location** consists of a ` start ` and ` end ` position.
70
+ And, if relevant, an ` indent ` property.
70
71
71
72
When the value represented by a node is not present in the document
72
- corresponding to the syntax tree, it must not have a location. These
73
- nodes are said to be _ generated_ .
73
+ corresponding to the syntax tree at the time of reading, it must not
74
+ have a location. These nodes are said to be _ generated_ .
74
75
75
76
``` idl
76
77
interface Location {
@@ -82,9 +83,9 @@ interface Location {
82
83
83
84
#### ` Position `
84
85
85
- ** Position** contains ` line ` and ` column ` set to a (1-based) integer
86
- referencing a position in a ** Unist** file. An ` offset ` (0 -based)
87
- may be used.
86
+ ** Position** references a point consisting of two indices in a
87
+ [ Unist file] [ file ] : ` line ` and ` column ` , set to 1 -based integers. An
88
+ ` offset ` (0-based) may be used.
88
89
89
90
``` idl
90
91
interface Position {
@@ -96,8 +97,8 @@ interface Position {
96
97
97
98
### ` Parent `
98
99
99
- Nodes containing child nodes inherit the ** Parent ** ( [ ** Node ** ] ( #node ) )
100
- abstract interface.
100
+ Nodes containing other nodes (said to be ** children ** ) extend the
101
+ abstract interface ** Parent ** ( [ ** Node ** ] ( #node ) ) .
101
102
102
103
``` idl
103
104
interface Parent <: Node {
@@ -107,8 +108,8 @@ interface Parent <: Node {
107
108
108
109
### ` Text `
109
110
110
- Nodes containing a value inherit the ** Text** ( [ ** Node ** ] ( #node ) )
111
- abstract interface .
111
+ Nodes containing a value extend the abstract interface ** Text**
112
+ ( [ ** Node ** ] ( #node ) ) .
112
113
113
114
``` idl
114
115
interface Text <: Node {
@@ -119,17 +120,17 @@ interface Text <: Node {
119
120
## Unist files
120
121
121
122
** Unist files** are virtual files (such as [ ** vfile** ] [ vfile ] )
122
- representing content at a certain location. They are not limited to
123
- existing files. Neither are they limited to the file-system only .
123
+ representing documents at a certain location. They are not limited to
124
+ existing files, nor to the file-system.
124
125
125
126
## Unist utilities
126
127
127
- ** Unist utilities** are function which work with ** unist nodes** ,
128
+ ** Unist utilities** are functions which work with ** unist nodes** ,
128
129
agnostic of ** remark** , ** retext** , or ** hast** .
129
130
130
- A list of ** VFile ** -related utilities can be found at [ ** vfile** ] [ vfile ] .
131
+ A list of ** vfile ** -related utilities can be found at [ ** vfile** ] [ vfile ] .
131
132
132
- ### List of Utilties
133
+ ### List of Utilities
133
134
134
135
* [ ` unist-util-filter ` ] ( https://github.com/eush77/unist-util-filter )
135
136
— Create a new Unist tree with all nodes that pass the test
@@ -190,7 +191,7 @@ A list of **VFile**-related utilities can be found at [**vfile**][vfile].
190
191
191
192
[ logo ] : https://cdn.rawgit.com/wooorm/unist/master/logo.svg
192
193
193
- [ changelog ] : https://github.com/wooorm/unist/releases
194
+ [ releases ] : https://github.com/wooorm/unist/releases
194
195
195
196
[ first-retext-commit ] : https://github.com/wooorm/retext/commit/8fcb1ff
196
197
@@ -206,12 +207,12 @@ A list of **VFile**-related utilities can be found at [**vfile**][vfile].
206
207
207
208
[ mdast ] : https://github.com/wooorm/mdast
208
209
209
- [ hast-nodes ] : https://github.com/wooorm/hast#nodes
210
-
211
210
[ vfile ] : https://github.com/wooorm/vfile
212
211
213
212
[ remark-html ] : https://github.com/wooorm/remark-html
214
213
215
214
[ parent ] : #parent
216
215
217
216
[ data ] : #data
217
+
218
+ [ file ] : #unist-files
0 commit comments