22
33** Uni** versal ** S** yntax ** T** ree.
44
5- ** *
5+ * * *
66
77** Unist** is the combination of three syntax trees, and more to come:
88[ ** mdast** ] [ mdast ] with [ ** remark** ] [ remark ] for markdown, [ ** nlcst** ] [ nlcst ]
@@ -12,8 +12,9 @@ with [**retext**][retext] for prose, and [**hast**][hast] with
1212This document explains some terminology relating to [ ** unified** ] [ unified ] and
1313[ ** vfile** ] [ vfile ] as well.
1414
15- This document may not be released. See [ releases] [ ] for released
16- documents. The latest released version is [ ` 1.1.0 ` ] ( https://github.com/syntax-tree/unist/releases/tag/1.1.0 ) .
15+ This document may not be released.
16+ See [ releases] [ ] for released documents.
17+ The latest released version is [ ` 1.1.0 ` ] ( https://github.com/syntax-tree/unist/releases/tag/1.1.0 ) .
1718
1819## Table of Contents
1920
@@ -31,29 +32,30 @@ documents. The latest released version is [`1.1.0`](https://github.com/syntax-tr
3132
3233## Unist nodes
3334
34- Subsets of Unist can define new properties on new nodes, and plug-ins
35- and utilities can define new [ ` data ` ] [ data ] properties on nodes. But,
36- the values on those properties ** must** be JSON values: ` string ` ,
37- ` number ` , ` object ` , ` array ` , ` true ` , ` false ` , or ` null ` . This means
38- that the syntax tree should be able to be converted to and from JSON
39- and produce the same tree. For example, in JavaScript, a tree should
40- be able to be passed through ` JSON.parse(JSON.stringify(tree)) ` and
41- result in the same values.
35+ Subsets of Unist can define new properties on new nodes, and plug-ins and
36+ utilities can define new [ ` data ` ] [ data ] properties on nodes.
37+ But, the values on those properties ** must** be JSON values: ` string ` ,
38+ ` number ` , ` object ` , ` array ` , ` true ` , ` false ` , or ` null ` .
39+ This means that the syntax tree should be able to be converted to and from JSON
40+ and produce the same tree.
41+ For example, in JavaScript, a tree should be able to be passed through
42+ ` JSON.parse(JSON.stringify(tree)) ` and result in the same values.
4243
4344See [ ** nlcst** ] [ nlcst ] for more information on ** retext** nodes,
4445[ ** mdast** ] [ mdast ] for information on ** remark** nodes, and
4546[ ** hast** ] [ hast ] for information on ** rehype** nodes.
4647
4748### ` Node `
4849
49- A Node represents any unit in the Unist hierarchy. It is an abstract
50- interface. Interfaces extending ** Node** must have a ` type ` property,
51- and may have ` data ` or ` position ` properties. The value of node [ type] [ ] s
52- are defined by their namespace.
50+ A Node represents any unit in the Unist hierarchy.
51+ It is an abstract interface.
52+ Interfaces extending ** Node** must have a ` type ` property, and may have
53+ ` data ` or ` position ` properties.
54+ The value of node [ type] [ ] s are defined by their namespace.
5355
54- Subsets of Unist are allowed to define properties on interfaces which
55- extend Unist’s abstract interfaces. For example, [ mdast ] [ ] defines
56- ** Link** ([ Parent] [ ] ) with a ` url ` property.
56+ Subsets of Unist are allowed to define properties on interfaces which extend
57+ Unist’s abstract interfaces.
58+ For example, [ mdast ] [ ] defines ** Link** ([ Parent] [ ] ) with a ` url ` property.
5759
5860``` idl
5961interface Node {
@@ -65,10 +67,10 @@ interface Node {
6567
6668#### ` Data `
6769
68- Data represents data associated with any node. ` Data ` is a scope for
69- plug-ins to store any information. For example, [ ` remark-html ` ] [ remark-html ]
70- uses ` hProperties ` to let other plug-ins specify properties added to the
71- compiled HTML element.
70+ Data represents data associated with any node.
71+ ` Data ` is a scope for plug-ins to store any information.
72+ For example, [ ` remark-html ` ] [ remark-html ] uses ` hProperties ` to let other
73+ plug-ins specify properties added to the compiled HTML element.
7274
7375``` idl
7476interface Data { }
@@ -77,12 +79,14 @@ interface Data { }
7779#### ` Position `
7880
7981** Position** references a range consisting of two points in a [ Unist
80- file] [ file ] . ** Position** consists of a ` start ` and ` end ` point.
82+ file] [ file ] .
83+ ** Position** consists of a ` start ` and ` end ` point.
8184And, if relevant, an ` indent ` property.
8285
8386When the value represented by a node is not present in the document
84- corresponding to the syntax tree at the time of reading, it must not
85- have positional information. These nodes are said to be _ generated_ .
87+ corresponding to the syntax tree at the time of reading, it must not have
88+ positional information.
89+ These nodes are said to be _ generated_ .
8690
8791``` idl
8892interface Position {
@@ -94,9 +98,9 @@ interface Position {
9498
9599#### ` Point `
96100
97- ** Point** references a point consisting of two indices in a
98- [ Unist file ] [ file ] : ` line ` and ` column ` , set to 1-based integers. An
99- ` offset ` (0-based) may be used.
101+ ** Point** references a point consisting of two indices in a [ Unist file ] [ file ] :
102+ ` line ` and ` column ` , set to 1-based integers.
103+ An ` offset ` (0-based) may be used.
100104
101105``` idl
102106interface Point {
@@ -108,8 +112,8 @@ interface Point {
108112
109113### ` Parent `
110114
111- Nodes containing other nodes (said to be ** children** ) extend the
112- abstract interface ** Parent** ([ ** Node** ] ( #node ) ).
115+ Nodes containing other nodes (said to be ** children** ) extend the abstract
116+ interface ** Parent** ([ ** Node** ] ( #node ) ).
113117
114118``` idl
115119interface Parent <: Node {
@@ -155,8 +159,7 @@ Node X is a **sibling** of node Y, if X and Y have the same
155159The ** previous sibling** of a [ child] [ ] is its ** sibling** at its [ index] [ ]
156160minus 1.
157161
158- The ** next sibling** of a [ child] [ ] is its ** sibling** at its [ index] [ ]
159- plus 1.
162+ The ** next sibling** of a [ child] [ ] is its ** sibling** at its [ index] [ ] plus 1.
160163
161164###### Root
162165
@@ -193,21 +196,21 @@ The **type** of a node is the value of its `type` property.
193196
194197## Unist files
195198
196- ** Unist files** are virtual files (such as [ ** vfile** ] [ vfile ] )
197- representing documents at a certain location. They are not limited to
198- existing files, nor to the file-system.
199+ ** Unist files** are virtual files (such as [ ** vfile** ] [ vfile ] ) representing
200+ documents at a certain location.
201+ They are not limited to existing files, nor to the file-system.
199202
200203## Unist utilities
201204
202- ** Unist utilities** are functions which work with ** unist nodes** ,
203- agnostic of ** remark** , ** retext** , or ** rehype** .
205+ ** Unist utilities** are functions which work with ** unist nodes** , agnostic of
206+ ** remark** , ** retext** , or ** rehype** .
204207
205208A list of ** vfile** -related utilities can be found at [ ** vfile** ] [ vfile ] .
206209
207210### List of Utilities
208211
209212* [ ` unist-util-assert ` ] ( https://github.com/syntax-tree/unist-util-assert )
210- — Assert Unist nodes
213+ — Assert nodes
211214* [ ` unist-util-filter ` ] ( https://github.com/eush77/unist-util-filter )
212215 — Create a new tree with all nodes that pass the given function
213216* [ ` unist-util-find ` ] ( https://github.com/blahah/unist-util-find )
@@ -241,9 +244,9 @@ A list of **vfile**-related utilities can be found at [**vfile**][vfile].
241244* [ ` unist-util-position ` ] ( https://github.com/syntax-tree/unist-util-position )
242245 — Get positional info of nodes
243246* [ ` unist-util-remove ` ] ( https://github.com/eush77/unist-util-remove )
244- — Remove nodes from Unist trees
247+ — Remove nodes from trees
245248* [ ` unist-util-remove-position ` ] ( https://github.com/syntax-tree/unist-util-remove-position )
246- — Remove positional info from a unist tree
249+ — Remove positional info from trees
247250* [ ` unist-util-select ` ] ( https://github.com/eush77/unist-util-select )
248251 — Select nodes with CSS-like selectors
249252* [ ` unist-util-source ` ] ( https://github.com/syntax-tree/unist-util-source )
@@ -261,21 +264,24 @@ A list of **vfile**-related utilities can be found at [**vfile**][vfile].
261264* [ ` unist-builder ` ] ( https://github.com/eush77/unist-builder )
262265 — Helper for creating trees
263266* [ ` unist-builder-blueprint ` ] ( https://github.com/eush77/unist-builder-blueprint )
264- — Convert Unist trees to unist-builder notation
267+ — Convert Unist trees to ` unist-builder ` notation
265268
266269## Contribute
267270
268- ** unist** is built by people just like you! Check out
269- [ ` contributing.md ` ] [ contributing ] for ways to get started.
271+ ** unist** is built by people just like you!
272+ Check out [ ` contributing.md ` ] [ contributing ] for ways to get started.
270273
271- This project has a [ Code of Conduct] [ coc ] . By interacting with this repository,
272- organisation, or community you agree to abide by its terms.
274+ This project has a [ Code of Conduct] [ coc ] .
275+ By interacting with this repository, organisation, or community you agree to
276+ abide by its terms.
273277
274- Want to chat with the community and contributors? Join us in [ Gitter] [ chat ] !
278+ Want to chat with the community and contributors?
279+ Join us in [ Gitter] [ chat ] !
275280
276- Have an idea for a cool new utility or tool? That’s great! If you want
277- feedback, help, or just to share it with the world you can do so by creating
278- an issue in the [ ` syntax-tree/ideas ` ] [ ideas ] repository!
281+ Have an idea for a cool new utility or tool?
282+ That’s great!
283+ If you want feedback, help, or just to share it with the world you can do so by
284+ creating an issue in the [ ` syntax-tree/ideas ` ] [ ideas ] repository!
279285
280286## Acknowledgments
281287
0 commit comments