@@ -17,18 +17,19 @@ The latest released version is [`1.0.2`][latest].
1717* [ Introduction] ( #introduction )
1818 * [ Where this specification fits] ( #where-this-specification-fits )
1919* [ Types] ( #types )
20- * [ Nodes] ( #nodes )
21- * [ ` Parent ` ] ( #parent )
20+ * [ Nodes (abstract)] ( #nodes-abstract )
2221 * [ ` Literal ` ] ( #literal )
23- * [ ` Root ` ] ( #root )
22+ * [ ` Parent ` ] ( #parent )
23+ * [ Nodes] ( #nodes )
2424 * [ ` Paragraph ` ] ( #paragraph )
25- * [ ` Sentence ` ] ( #sentence )
26- * [ ` Word ` ] ( #word )
27- * [ ` Symbol ` ] ( #symbol )
2825 * [ ` Punctuation ` ] ( #punctuation )
29- * [ ` WhiteSpace ` ] ( #whitespace )
26+ * [ ` Root ` ] ( #root )
27+ * [ ` Sentence ` ] ( #sentence )
3028 * [ ` Source ` ] ( #source )
29+ * [ ` Symbol ` ] ( #symbol )
3130 * [ ` Text ` ] ( #text )
31+ * [ ` WhiteSpace ` ] ( #whitespace )
32+ * [ ` Word ` ] ( #word )
3233* [ Glossary] ( #glossary )
3334* [ List of utilities] ( #list-of-utilities )
3435* [ Related] ( #related )
@@ -61,27 +62,14 @@ trees are used throughout their ecosystems.
6162
6263## Types
6364
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
6566with npm:
6667
6768``` sh
6869npm install @types/nlcst
6970```
7071
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)
8573
8674### ` Literal `
8775
@@ -96,20 +84,20 @@ containing a value.
9684
9785Its ` value ` field is a ` string ` .
9886
99- ### ` Root `
87+ ### ` Parent `
10088
10189``` idl
102- interface Root <: Parent {
103- type: 'RootNode'
90+ interface Parent <: UnistParent {
91+ children: [Paragraph | Punctuation | Sentence | Source | Symbol | Text | WhiteSpace | Word]
10492}
10593```
10694
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 ] ).
10897
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
113101
114102### ` Paragraph `
115103
@@ -127,6 +115,35 @@ with a particular point or idea.
127115It can contain [ ** sentence** ] [ dfn-sentence ] , [ ** whitespace** ] [ dfn-whitespace ] ,
128116and [ ** source** ] [ dfn-source ] nodes.
129117
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+
130147### ` Sentence `
131148
132149``` idl
@@ -145,21 +162,19 @@ It can contain [**word**][dfn-word], [**symbol**][dfn-symbol],
145162[ ** punctuation** ] [ dfn-punctuation ] , [ ** whitespace** ] [ dfn-whitespace ] , and
146163[ ** source** ] [ dfn-source ] nodes.
147164
148- ### ` Word `
165+ ### ` Source `
149166
150167``` idl
151- interface Word <: Parent {
152- type: 'WordNode'
153- children: [Punctuation | Source | Symbol | Text]
168+ interface Source <: Literal {
169+ type: 'SourceNode'
154170}
155171```
156172
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 .
159175
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.
163178
164179### ` Symbol `
165180
@@ -176,19 +191,18 @@ white space, or punctuation.
176191** Symbol** can be used in [ ** sentence** ] [ dfn-sentence ] or [ ** word** ] [ dfn-word ]
177192nodes.
178193
179- ### ` Punctuation `
194+ ### ` Text `
180195
181196``` idl
182- interface Punctuation <: Literal {
183- type: 'PunctuationNode '
197+ interface Text <: Literal {
198+ type: 'TextNode '
184199}
185200```
186201
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 .
189204
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.
192206
193207### ` WhiteSpace `
194208
@@ -204,32 +218,21 @@ devoid of content, separating other units.
204218** WhiteSpace** can be used in [ ** root** ] [ dfn-root ] ,
205219[ ** paragraph** ] [ dfn-paragraph ] , or [ ** sentence** ] [ dfn-sentence ] nodes.
206220
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 `
222222
223223``` idl
224- interface Text <: Literal {
225- type: 'TextNode'
224+ interface Word <: Parent {
225+ type: 'WordNode'
226+ children: [Punctuation | Source | Symbol | Text]
226227}
227228```
228229
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 .
231232
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.
233236
234237## Glossary
235238
0 commit comments