5
5
[ ![ Downloads] [ downloads-badge ]] [ downloads ]
6
6
[ ![ Size] [ size-badge ]] [ size ]
7
7
8
- Helper for creating [ ** unist** ] [ unist ] trees with [ hyperscript] [ ] -like syntax.
8
+ [ ** unist** ] [ unist ] utility to create a new [ tree] [ ] s with [ hyperscript] [ ] -like
9
+ syntax.
9
10
10
- ## Installation
11
+ ## Install
11
12
12
13
[ npm] [ ] :
13
14
@@ -23,8 +24,9 @@ var u = require('unist-builder')
23
24
var tree = u (' root' , [
24
25
u (' subtree' , {id: 1 }),
25
26
u (' subtree' , {id: 2 }, [
26
- u (' node' , [u (' leaf' , ' leaf-1' ), u (' leaf' , ' leaf-2' )]),
27
- u (' leaf' , {id: 3 }, ' leaf-3' )
27
+ u (' node' , [u (' leaf' , ' leaf 1' ), u (' leaf' , ' leaf 2' )]),
28
+ u (' leaf' , {id: 3 }, ' leaf 3' ),
29
+ u (' void' , {id: 4 })
28
30
])
29
31
])
30
32
@@ -45,11 +47,12 @@ results in the following tree:
45
47
{
46
48
type: ' node' ,
47
49
children: [
48
- {type: ' leaf' , value: ' leaf- 1' },
49
- {type: ' leaf' , value: ' leaf- 2' }
50
+ {type: ' leaf' , value: ' leaf 1' },
51
+ {type: ' leaf' , value: ' leaf 2' }
50
52
]
51
53
},
52
- {type: ' leaf' , id: 3 , value: ' leaf-3' }
54
+ {type: ' leaf' , id: 3 , value: ' leaf 3' },
55
+ {type: ' void' , id: 4 }
53
56
]
54
57
}
55
58
]
@@ -65,7 +68,7 @@ Creates a node from `props`, `children`, and optionally `value`.
65
68
###### Signatures
66
69
67
70
* ` u(type[, props], children) ` — create a [ parent] [ ]
68
- * ` u(type[, props], value) ` — create a [ text ] [ ]
71
+ * ` u(type[, props], value) ` — create a [ literal ] [ ]
69
72
* ` u(type[, props]) ` — create a void node
70
73
71
74
###### Parameters
@@ -88,11 +91,13 @@ Creates a node from `props`, `children`, and optionally `value`.
88
91
89
92
## Contribute
90
93
91
- See [ ` contributing.md ` in ` syntax-tree/unist ` ] [ contributing ] for ways to get
94
+ See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
92
95
started.
96
+ See [ ` support.md ` ] [ support ] for ways to get help.
93
97
94
- This organisation has a [ Code of Conduct] [ coc ] . By interacting with this
95
- repository, organisation, or community you agree to abide by its terms.
98
+ This project has a [ Code of Conduct] [ coc ] .
99
+ By interacting with this repository, organisation, or community you agree to
100
+ abide by its terms.
96
101
97
102
## License
98
103
@@ -120,9 +125,11 @@ repository, organisation, or community you agree to abide by its terms.
120
125
121
126
[ license ] : license
122
127
123
- [ contributing ] : https://github.com/syntax-tree/unist /blob/master/contributing.md
128
+ [ contributing ] : https://github.com/syntax-tree/.github /blob/master/contributing.md
124
129
125
- [ coc ] : https://github.com/syntax-tree/unist/blob/master/code-of-conduct.md
130
+ [ support ] : https://github.com/syntax-tree/.github/blob/master/support.md
131
+
132
+ [ coc ] : https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md
126
133
127
134
[ unist ] : https://github.com/syntax-tree/unist
128
135
@@ -132,8 +139,10 @@ repository, organisation, or community you agree to abide by its terms.
132
139
133
140
[ node ] : https://github.com/syntax-tree/unist#node
134
141
142
+ [ tree ] : https://github.com/syntax-tree/unist#tree
143
+
135
144
[ parent ] : https://github.com/syntax-tree/unist#parent
136
145
137
- [ text ] : https://github.com/syntax-tree/unist#text
146
+ [ literal ] : https://github.com/syntax-tree/unist#literal
138
147
139
148
[ type ] : https://github.com/syntax-tree/unist#type
0 commit comments