Skip to content

Commit 6104bee

Browse files
committed
Refactor wording
* Typo’s; * Phrasing improvements; * Remove class-related wording, no “inheriting” and subclassing anymore; * Clarify wording related to locations and position, such as adding “range”, “point”, and “indices”; * Update wording relating to “hast”; * Clarify that the currently viewed document may not be the latest releases version of Unist.
1 parent 542b156 commit 6104bee

File tree

1 file changed

+34
-33
lines changed

1 file changed

+34
-33
lines changed

readme.md

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,18 @@
88
are the summation of at least [two][first-retext-commit]
99
[years][first-remark-commit] of my work and the current epitome of that.
1010

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.
1314

1415
This document explains some terminology relating to [**retext**][retext],
1516
[**remark**][remark], [**hast**][hast], and their related projects.
1617

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.
1920

2021
## Unist nodes
2122

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-
2623
Subsets of Unist can define new properties on new nodes, and plug-ins
2724
and utilities can define new [`data`][data] properties on nodes. But,
2825
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
3229
be able to be passed through `JSON.parse(JSON.stringify(tree))` and
3330
result in the same values.
3431

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+
3536
### `Node`
3637

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
4041
their namespace.
4142

4243
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.
4546

4647
```idl
4748
interface Node {
@@ -64,13 +65,13 @@ interface Data { }
6465

6566
#### `Location`
6667

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.
7071

7172
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_.
7475

7576
```idl
7677
interface Location {
@@ -82,9 +83,9 @@ interface Location {
8283

8384
#### `Position`
8485

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.
8889

8990
```idl
9091
interface Position {
@@ -96,8 +97,8 @@ interface Position {
9697

9798
### `Parent`
9899

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)).
101102

102103
```idl
103104
interface Parent <: Node {
@@ -107,8 +108,8 @@ interface Parent <: Node {
107108

108109
### `Text`
109110

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)).
112113

113114
```idl
114115
interface Text <: Node {
@@ -119,17 +120,17 @@ interface Text <: Node {
119120
## Unist files
120121

121122
**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.
124125

125126
## Unist utilities
126127

127-
**Unist utilities** are function which work with **unist nodes**,
128+
**Unist utilities** are functions which work with **unist nodes**,
128129
agnostic of **remark**, **retext**, or **hast**.
129130

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].
131132

132-
### List of Utilties
133+
### List of Utilities
133134

134135
* [`unist-util-filter`](https://github.com/eush77/unist-util-filter)
135136
— 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].
190191

191192
[logo]: https://cdn.rawgit.com/wooorm/unist/master/logo.svg
192193

193-
[changelog]: https://github.com/wooorm/unist/releases
194+
[releases]: https://github.com/wooorm/unist/releases
194195

195196
[first-retext-commit]: https://github.com/wooorm/retext/commit/8fcb1ff
196197

@@ -206,12 +207,12 @@ A list of **VFile**-related utilities can be found at [**vfile**][vfile].
206207

207208
[mdast]: https://github.com/wooorm/mdast
208209

209-
[hast-nodes]: https://github.com/wooorm/hast#nodes
210-
211210
[vfile]: https://github.com/wooorm/vfile
212211

213212
[remark-html]: https://github.com/wooorm/remark-html
214213

215214
[parent]: #parent
216215

217216
[data]: #data
217+
218+
[file]: #unist-files

0 commit comments

Comments
 (0)