Skip to content

Commit 2ba54c0

Browse files
committed
Remove ancient nodes
This removes the `directive` and `characterData` nodes, and adds a new `doctype` node. This better represents the fact that HAST is for HTML, not XML. Closes GH-5. Closes GH-7.
1 parent 49cca9a commit 2ba54c0

File tree

1 file changed

+13
-34
lines changed

1 file changed

+13
-34
lines changed

readme.md

+13-34
Original file line numberDiff line numberDiff line change
@@ -180,31 +180,33 @@ values. In HAST, these should be treated as ordered lists. For example,
180180

181181
> There’s no special format for `style`.
182182
183-
### `Directive`
183+
### `Doctype`
184184

185-
**Directive** ([**Text**][text]) represents an instruction
186-
(declaration or processing instruction).
185+
**Doctype** ([**Node**][node]) defines the type of the document.
187186

188187
```idl
189-
interface Directive <: Text {
190-
type: "directive";
188+
interface Doctype <: Node {
189+
type: "doctype";
191190
name: string;
191+
public: string?;
192+
system: string?;
192193
}
193194
```
194195

195196
For example, the following HTML:
196197

197198
```html
198-
<!doctype html>
199+
<!DOCTYPE html>
199200
```
200201

201202
Yields:
202203

203204
```json
204205
{
205-
"type": "directive",
206-
"name": "!doctype",
207-
"value": "!doctype html"
206+
"type": "doctype",
207+
"name": "html",
208+
"public": null,
209+
"system": null
208210
}
209211
```
210212

@@ -233,31 +235,6 @@ Yields:
233235
}
234236
```
235237

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[<delta>Echo</delta>]]>
250-
```
251-
252-
Yields:
253-
254-
```json
255-
{
256-
"type": "characterData",
257-
"value": "<delta>Echo</delta>"
258-
}
259-
```
260-
261238
### `Text`
262239

263240
**TextNode** ([**Text**][text]) represents everything that is text.
@@ -310,6 +287,8 @@ Yields:
310287

311288
[unist]: https://github.com/wooorm/unist
312289

290+
[node]: https://github.com/wooorm/unist#node
291+
313292
[parent]: https://github.com/wooorm/unist#parent
314293

315294
[text]: https://github.com/wooorm/unist#text

0 commit comments

Comments
 (0)