@@ -17,18 +17,19 @@ The latest released version is [`1.0.2`][latest].
17
17
* [ Introduction] ( #introduction )
18
18
* [ Where this specification fits] ( #where-this-specification-fits )
19
19
* [ Types] ( #types )
20
- * [ Nodes] ( #nodes )
21
- * [ ` Parent ` ] ( #parent )
20
+ * [ Nodes (abstract)] ( #nodes-abstract )
22
21
* [ ` Literal ` ] ( #literal )
23
- * [ ` Root ` ] ( #root )
22
+ * [ ` Parent ` ] ( #parent )
23
+ * [ Nodes] ( #nodes )
24
24
* [ ` Paragraph ` ] ( #paragraph )
25
- * [ ` Sentence ` ] ( #sentence )
26
- * [ ` Word ` ] ( #word )
27
- * [ ` Symbol ` ] ( #symbol )
28
25
* [ ` Punctuation ` ] ( #punctuation )
29
- * [ ` WhiteSpace ` ] ( #whitespace )
26
+ * [ ` Root ` ] ( #root )
27
+ * [ ` Sentence ` ] ( #sentence )
30
28
* [ ` Source ` ] ( #source )
29
+ * [ ` Symbol ` ] ( #symbol )
31
30
* [ ` Text ` ] ( #text )
31
+ * [ ` WhiteSpace ` ] ( #whitespace )
32
+ * [ ` Word ` ] ( #word )
32
33
* [ Glossary] ( #glossary )
33
34
* [ List of utilities] ( #list-of-utilities )
34
35
* [ Related] ( #related )
@@ -61,27 +62,14 @@ trees are used throughout their ecosystems.
61
62
62
63
## Types
63
64
64
- If you are using TypeScript, you can use the unist types by installing them
65
+ If you are using TypeScript, you can use the nlcst types by installing them
65
66
with npm:
66
67
67
68
``` sh
68
69
npm install @types/nlcst
69
70
```
70
71
71
- ## Nodes
72
-
73
- ### ` Parent `
74
-
75
- ``` idl
76
- interface Parent <: UnistParent {
77
- children: [Paragraph | Sentence | Word | Symbol | Punctuation | WhiteSpace | Source | Text]
78
- }
79
- ```
80
-
81
- ** Parent** ([ ** UnistParent** ] [ dfn-unist-parent ] ) represents a node in nlcst
82
- containing other nodes (said to be [ * children* ] [ term-child ] ).
83
-
84
- Its content is limited to only other nlcst content.
72
+ ## Nodes (abstract)
85
73
86
74
### ` Literal `
87
75
@@ -96,20 +84,20 @@ containing a value.
96
84
97
85
Its ` value ` field is a ` string ` .
98
86
99
- ### ` Root `
87
+ ### ` Parent `
100
88
101
89
``` idl
102
- interface Root <: Parent {
103
- type: 'RootNode'
90
+ interface Parent <: UnistParent {
91
+ children: [Paragraph | Punctuation | Sentence | Source | Symbol | Text | WhiteSpace | Word]
104
92
}
105
93
```
106
94
107
- ** Root** ([ ** Parent** ] [ dfn-parent ] ) represents a document.
95
+ ** Parent** ([ ** UnistParent** ] [ dfn-unist-parent ] ) represents a node in nlcst
96
+ containing other nodes (said to be [ * children* ] [ term-child ] ).
108
97
109
- ** Root** can be used as the [ * root* ] [ term-root ] of a [ * tree* ] [ term-tree ] , never
110
- as a [ * child* ] [ term-child ] .
111
- Its content model is not limited, it can contain any nlcst content, with the
112
- restriction that all content must be of the same category.
98
+ Its content is limited to only other nlcst content.
99
+
100
+ ## Nodes
113
101
114
102
### ` Paragraph `
115
103
@@ -127,6 +115,35 @@ with a particular point or idea.
127
115
It can contain [ ** sentence** ] [ dfn-sentence ] , [ ** whitespace** ] [ dfn-whitespace ] ,
128
116
and [ ** source** ] [ dfn-source ] nodes.
129
117
118
+ ### ` Punctuation `
119
+
120
+ ``` idl
121
+ interface Punctuation <: Literal {
122
+ type: 'PunctuationNode'
123
+ }
124
+ ```
125
+
126
+ ** Punctuation** ([ ** Literal** ] [ dfn-literal ] ) represents typographical devices
127
+ which aid understanding and correct reading of other grammatical units.
128
+
129
+ ** Punctuation** can be used in [ ** sentence** ] [ dfn-sentence ] or
130
+ [ ** word** ] [ dfn-word ] nodes.
131
+
132
+ ### ` Root `
133
+
134
+ ``` idl
135
+ interface Root <: Parent {
136
+ type: 'RootNode'
137
+ }
138
+ ```
139
+
140
+ ** Root** ([ ** Parent** ] [ dfn-parent ] ) represents a document.
141
+
142
+ ** Root** can be used as the [ * root* ] [ term-root ] of a [ * tree* ] [ term-tree ] , never
143
+ as a [ * child* ] [ term-child ] .
144
+ Its content model is not limited, it can contain any nlcst content, with the
145
+ restriction that all content must be of the same category.
146
+
130
147
### ` Sentence `
131
148
132
149
``` idl
@@ -145,21 +162,19 @@ It can contain [**word**][dfn-word], [**symbol**][dfn-symbol],
145
162
[ ** punctuation** ] [ dfn-punctuation ] , [ ** whitespace** ] [ dfn-whitespace ] , and
146
163
[ ** source** ] [ dfn-source ] nodes.
147
164
148
- ### ` Word `
165
+ ### ` Source `
149
166
150
167
``` idl
151
- interface Word <: Parent {
152
- type: 'WordNode'
153
- children: [Punctuation | Source | Symbol | Text]
168
+ interface Source <: Literal {
169
+ type: 'SourceNode'
154
170
}
155
171
```
156
172
157
- ** Word ** ([ ** Parent ** ] [ dfn-parent ] ) represents the smallest element that may be
158
- uttered in isolation with semantic or pragmatic content .
173
+ ** Source ** ([ ** Literal ** ] [ dfn-literal ] ) represents an external (ungrammatical)
174
+ value embedded into a grammatical unit: a hyperlink, code, and such .
159
175
160
- ** Word** can be used in a [ ** sentence** ] [ dfn-sentence ] node.
161
- It can contain [ ** text** ] [ dfn-text ] , [ ** symbol** ] [ dfn-symbol ] ,
162
- [ ** punctuation** ] [ dfn-punctuation ] , and [ ** source** ] [ dfn-source ] nodes.
176
+ ** Source** can be used in [ ** root** ] [ dfn-root ] , [ ** paragraph** ] [ dfn-paragraph ] ,
177
+ [ ** sentence** ] [ dfn-sentence ] , or [ ** word** ] [ dfn-word ] nodes.
163
178
164
179
### ` Symbol `
165
180
@@ -176,19 +191,18 @@ white space, or punctuation.
176
191
** Symbol** can be used in [ ** sentence** ] [ dfn-sentence ] or [ ** word** ] [ dfn-word ]
177
192
nodes.
178
193
179
- ### ` Punctuation `
194
+ ### ` Text `
180
195
181
196
``` idl
182
- interface Punctuation <: Literal {
183
- type: 'PunctuationNode '
197
+ interface Text <: Literal {
198
+ type: 'TextNode '
184
199
}
185
200
```
186
201
187
- ** Punctuation ** ([ ** Literal** ] [ dfn-literal ] ) represents typographical devices
188
- which aid understanding and correct reading of other grammatical units .
202
+ ** Text ** ([ ** Literal** ] [ dfn-literal ] ) represents actual content in nlcst
203
+ documents: one or more characters .
189
204
190
- ** Punctuation** can be used in [ ** sentence** ] [ dfn-sentence ] or
191
- [ ** word** ] [ dfn-word ] nodes.
205
+ ** Text** can be used in [ ** word** ] [ dfn-word ] nodes.
192
206
193
207
### ` WhiteSpace `
194
208
@@ -204,32 +218,21 @@ devoid of content, separating other units.
204
218
** WhiteSpace** can be used in [ ** root** ] [ dfn-root ] ,
205
219
[ ** paragraph** ] [ dfn-paragraph ] , or [ ** sentence** ] [ dfn-sentence ] nodes.
206
220
207
- ### ` Source `
208
-
209
- ``` idl
210
- interface Source <: Literal {
211
- type: 'SourceNode'
212
- }
213
- ```
214
-
215
- ** Source** ([ ** Literal** ] [ dfn-literal ] ) represents an external (ungrammatical)
216
- value embedded into a grammatical unit: a hyperlink, code, and such.
217
-
218
- ** Source** can be used in [ ** root** ] [ dfn-root ] , [ ** paragraph** ] [ dfn-paragraph ] ,
219
- [ ** sentence** ] [ dfn-sentence ] , or [ ** word** ] [ dfn-word ] nodes.
220
-
221
- ### ` Text `
221
+ ### ` Word `
222
222
223
223
``` idl
224
- interface Text <: Literal {
225
- type: 'TextNode'
224
+ interface Word <: Parent {
225
+ type: 'WordNode'
226
+ children: [Punctuation | Source | Symbol | Text]
226
227
}
227
228
```
228
229
229
- ** Text ** ([ ** Literal ** ] [ dfn-literal ] ) represents actual content in nlcst
230
- documents: one or more characters .
230
+ ** Word ** ([ ** Parent ** ] [ dfn-parent ] ) represents the smallest element that may be
231
+ uttered in isolation with semantic or pragmatic content .
231
232
232
- ** Text** can be used in [ ** word** ] [ dfn-word ] nodes.
233
+ ** Word** can be used in a [ ** sentence** ] [ dfn-sentence ] node.
234
+ It can contain [ ** text** ] [ dfn-text ] , [ ** symbol** ] [ dfn-symbol ] ,
235
+ [ ** punctuation** ] [ dfn-punctuation ] , and [ ** source** ] [ dfn-source ] nodes.
233
236
234
237
## Glossary
235
238
0 commit comments