Skip to content

Commit dd1fe81

Browse files
committed
Update exaples in readme
1 parent ae8239e commit dd1fe81

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

readme.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,12 @@ Say we have the following `example.html`:
8585

8686
```js
8787
import {promises as fs} from 'node:fs'
88-
import {parseFragment} from 'parse5'
89-
import {fromParse5} from 'hast-util-from-parse5'
88+
import {fromHtml} from 'hast-util-from-html'
9089
import {toMdast} from 'hast-util-to-mdast'
9190
import {toMarkdown} from 'mdast-util-to-markdown'
9291

9392
const html = String(await fs.readFile('example.html'))
94-
const parse5 = parseFragment(html)
95-
const hast = fromParse5(parse5)
93+
const hast = fromHtml(html, {fragment: true})
9694
const mdast = toMdast(hast)
9795
const markdown = toMarkdown(mdast)
9896

@@ -245,15 +243,13 @@ This can be achieved with `example.js` like so:
245243

246244
```js
247245
import {promises as fs} from 'node:fs'
248-
import {parseFragment} from 'parse5'
249-
import {fromParse5} from 'hast-util-from-parse5'
246+
import {fromHtml} from 'hast-util-from-html'
250247
import {toMdast} from 'hast-util-to-mdast'
251248
import {toHtml} from 'hast-util-to-html'
252249
import {toMarkdown} from 'mdast-util-to-markdown'
253250

254251
const html = String(await fs.readFile('example.html'))
255-
const parse5 = parseFragment(html)
256-
const hast = fromParse5(parse5)
252+
const hast = fromHtml(html, {fragment: true})
257253
const mdast = toMdast(hast, {
258254
handlers: {
259255
svg(h, node) {

0 commit comments

Comments
 (0)