Skip to content

Commit d8feb73

Browse files
committed
Add markdown formatting
1 parent 2ff238e commit d8feb73

File tree

3 files changed

+85
-49
lines changed

3 files changed

+85
-49
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
*.log
3+
node_modules/

package.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "unist",
3+
"private": true,
4+
"version": "0.0.0",
5+
"description": "universal syntax tree",
6+
"license": "CC-BY-4.0",
7+
"keywords": [],
8+
"repository": "syntax-tree/unist",
9+
"bugs": "https://github.com/syntax-tree/unist/issues",
10+
"author": "Titus Wormer <tituswormer@gmail.com> (wooorm.com)",
11+
"contributors": [
12+
"Titus Wormer <tituswormer@gmail.com> (wooorm.com)",
13+
"Eugene Sharygin <eush77@gmail.com>"
14+
],
15+
"devDependencies": {
16+
"remark-cli": "^5.0.0",
17+
"remark-preset-wooorm": "^4.0.0"
18+
},
19+
"scripts": {
20+
"format": "remark . -qfo"
21+
},
22+
"remarkConfig": {
23+
"plugins": [
24+
"preset-wooorm"
25+
]
26+
}
27+
}

readme.md

Lines changed: 55 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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
1212
This 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

4344
See [**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
5961
interface 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
7476
interface 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.
8184
And, if relevant, an `indent` property.
8285

8386
When 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
8892
interface 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
102106
interface 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
115119
interface Parent <: Node {
@@ -155,8 +159,7 @@ Node X is a **sibling** of node Y, if X and Y have the same
155159
The **previous sibling** of a [child][] is its **sibling** at its [index][]
156160
minus 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

205208
A 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

Comments
 (0)