Refactor to clarify wording around positional info · syntax-tree/unist@f2b8587 (original) (raw)
`@@ -44,7 +44,7 @@ See [nlcst][nlcst] for more information on retext nodes,
`
44
44
``
45
45
`A Node represents any unit in the Unist hierarchy. It is an abstract
`
46
46
`` interface. Interfaces extending Node must have a type
property,
``
47
``
`` -
and may have data
or location
properties. type
s are defined by
``
``
47
`` +
and may have data
or position
properties. type
s are defined by
``
48
48
`their namespace.
`
49
49
``
50
50
`Subsets of Unist are allowed to define properties on interfaces which
`
`@@ -55,7 +55,7 @@ extend Unist’s abstract interfaces. For example, [mdast][] defines
`
55
55
`interface Node {
`
56
56
` type: string;
`
57
57
` data: Data?;
`
58
``
`-
position: Location?;
`
``
58
`+
position: Position?;
`
59
59
`}
`
60
60
```` ```
`61`
`61`
``
`@@ -70,32 +70,32 @@ compiled HTML element.
`
`70`
`70`
`interface Data { }
`
`71`
`71`
```` ```
72
72
``
73
``
`` -
Location
``
``
73
`` +
Position
``
74
74
``
75
``
`-
Location references a range consisting of two points in a [Unist
`
76
``
`` -
file][file]. Location consists of a start
and end
position.
``
``
75
`+
Position references a range consisting of two points in a [Unist
`
``
76
`` +
file][file]. Position consists of a start
and end
point.
``
77
77
`` And, if relevant, an indent
property.
``
78
78
``
79
79
`When the value represented by a node is not present in the document
`
80
80
`corresponding to the syntax tree at the time of reading, it must not
`
81
``
`-
have a location. These nodes are said to be generated.
`
``
81
`+
have positional information. These nodes are said to be generated.
`
82
82
``
83
83
```` ```idl
`84`
``
`-
interface Location {
`
`85`
``
`-
start: Position;
`
`86`
``
`-
end: Position;
`
``
`84`
`+
interface Position {
`
``
`85`
`+
start: Point;
`
``
`86`
`+
end: Point;
`
`87`
`87`
` indent: [uint32 >= 1]?;
`
`88`
`88`
`}
`
`89`
`89`
```` ```
90
90
``
91
``
`` -
Position
``
``
91
`` +
Point
``
92
92
``
93
``
`-
Position references a point consisting of two indices in a
`
``
93
`+
Point references a point consisting of two indices in a
`
94
94
`` [Unist file][file]: line
and column
, set to 1-based integers. An
``
95
95
`` offset
(0-based) may be used.
``
96
96
``
97
97
```` ```idl
````
98
``
`-
interface Position {
`
``
98
`+
interface Point {
`
99
99
` line: uint32 >= 1;
`
100
100
` column: uint32 >= 1;
`
101
101
` offset: uint32 >= 0?;
`
`@@ -148,9 +148,9 @@ A list of vfile-related utilities can be found at [vfile][vfile].
`
148
148
``
149
149
` — Find a node after another node
`
150
150
`` * unist-util-find-all-after
``
151
``
`-
— Find nodes after another node or position
`
``
151
`+
— Find nodes after another node or index
`
152
152
`` * unist-util-find-all-before
``
153
``
`-
— Find nodes before another node or position
`
``
153
`+
— Find nodes before another node or index
`
154
154
`` * unist-util-find-all-between
``
155
155
` — Find nodes between two nodes or positions
`
156
156
``
`@@ -170,17 +170,17 @@ A list of vfile-related utilities can be found at [vfile][vfile].
`
170
170
`` * unist-util-parents
``
171
171
`` — parent
references on nodes
``
172
172
`` * unist-util-position
``
173
``
`-
— Get the position of nodes
`
``
173
`+
— Get positional info of nodes
`
174
174
`` * unist-util-remove
``
175
175
` — Remove nodes from Unist trees
`
176
176
`` * unist-util-remove-position
``
177
``
`` -
— Remove position
s from a unist tree
``
``
177
`+
— Remove positional info from a unist tree
`
178
178
`` * unist-util-select
``
179
179
` — Select nodes with CSS-like selectors
`
180
180
`` * unist-util-source
``
181
``
`-
— Get the source of a value (node, location)
`
``
181
`+
— Get the source of a value (node or position) in a file
`
182
182
`` * unist-util-stringify-position
``
183
``
`-
— Stringify a node, location, or position
`
``
183
`+
— Stringify a node, position, or point
`
184
184
`` * unist-util-visit
``
185
185
` — Recursively walk over nodes
`
186
186
``