Skip to content

Commit 8c7c408

Browse files
committed
Update example
1 parent 6b2e753 commit 8c7c408

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

readme.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,12 @@ Say our document `example.html` contains:
7979

8080
```js
8181
import fs from 'node:fs/promises'
82-
import {unified} from 'unified'
83-
import rehypeParse from 'rehype-parse'
82+
import {fromHtml} from 'hast-util-from-html'
8483
import {toXast} from 'hast-util-to-xast'
8584
import {toXml} from 'xast-util-to-xml'
8685

8786
// Get the HTML syntax tree:
88-
const hast = unified()
89-
.use(rehypeParse)
90-
.parse(await fs.readFile('example.html'))
87+
const hast = fromHtml(await fs.readFile('example.html'))
9188

9289
// Turn hast to xast:
9390
const xast = toXast(hast)

0 commit comments

Comments
 (0)