@@ -180,31 +180,33 @@ values. In HAST, these should be treated as ordered lists. For example, |
|
|
180 |
180 |
|
181 |
181 |
> There’s no special format for `style`. |
182 |
182 |
|
183 |
|
-### `Directive` |
|
183 |
+### `Doctype` |
184 |
184 |
|
185 |
|
-**Directive** ([**Text**][text]) represents an instruction |
186 |
|
-(declaration or processing instruction). |
|
185 |
+**Doctype** ([**Node**][node]) defines the type of the document. |
187 |
186 |
|
188 |
187 |
```idl |
189 |
|
-interface Directive <: Text { |
190 |
|
- type: "directive"; |
|
188 |
+interface Doctype <: Node { |
|
189 |
+ type: "doctype"; |
191 |
190 |
name: string; |
|
191 |
+ public: string?; |
|
192 |
+ system: string?; |
192 |
193 |
} |
193 |
194 |
``` |
194 |
195 |
|
195 |
196 |
For example, the following HTML: |
196 |
197 |
|
197 |
198 |
```html |
198 |
|
- |
|
199 |
+ |
199 |
200 |
``` |
200 |
201 |
|
201 |
202 |
Yields: |
202 |
203 |
|
203 |
204 |
```json |
204 |
205 |
{ |
205 |
|
-"type": "directive", |
206 |
|
-"name": "!doctype", |
207 |
|
-"value": "!doctype html" |
|
206 |
+"type": "doctype", |
|
207 |
+"name": "html", |
|
208 |
+"public": null, |
|
209 |
+"system": null |
208 |
210 |
} |
209 |
211 |
``` |
210 |
212 |
|
@@ -233,31 +235,6 @@ Yields: |
|
|
233 |
235 |
} |
234 |
236 |
``` |
235 |
237 |
|
236 |
|
-### `CharacterData` |
237 |
|
- |
238 |
|
-**CharacterData** ([**Text**][text]) represents character data. |
239 |
|
- |
240 |
|
-```idl |
241 |
|
-interface CharacterData <: Text { |
242 |
|
- type: "characterData"; |
243 |
|
-} |
244 |
|
-``` |
245 |
|
- |
246 |
|
-For example, the following HTML: |
247 |
|
- |
248 |
|
-```html |
249 |
|
-<![CDATA[Echo]]> |
250 |
|
-``` |
251 |
|
- |
252 |
|
-Yields: |
253 |
|
- |
254 |
|
-```json |
255 |
|
-{ |
256 |
|
-"type": "characterData", |
257 |
|
-"value": "Echo" |
258 |
|
-} |
259 |
|
-``` |
260 |
|
- |
261 |
238 |
### `Text` |
262 |
239 |
|
263 |
240 |
**TextNode** ([**Text**][text]) represents everything that is text. |
@@ -310,6 +287,8 @@ Yields: |
|
|
310 |
287 |
|
311 |
288 |
[unist]: https://github.com/wooorm/unist |
312 |
289 |
|
|
290 |
+[node]: https://github.com/wooorm/unist#node |
|
291 |
+ |
313 |
292 |
[parent]: https://github.com/wooorm/unist#parent |
314 |
293 |
|
315 |
294 |
[text]: https://github.com/wooorm/unist#text |