@@ -85,14 +85,12 @@ Say we have the following `example.html`:
8585
8686``` js
8787import {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'
9089import {toMdast } from ' hast-util-to-mdast'
9190import {toMarkdown } from ' mdast-util-to-markdown'
9291
9392const html = String (await fs .readFile (' example.html' ))
94- const parse5 = parseFragment (html)
95- const hast = fromParse5 (parse5)
93+ const hast = fromHtml (html, {fragment: true })
9694const mdast = toMdast (hast)
9795const markdown = toMarkdown (mdast)
9896
@@ -245,15 +243,13 @@ This can be achieved with `example.js` like so:
245243
246244``` js
247245import {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'
250247import {toMdast } from ' hast-util-to-mdast'
251248import {toHtml } from ' hast-util-to-html'
252249import {toMarkdown } from ' mdast-util-to-markdown'
253250
254251const html = String (await fs .readFile (' example.html' ))
255- const parse5 = parseFragment (html)
256- const hast = fromParse5 (parse5)
252+ const hast = fromHtml (html, {fragment: true })
257253const mdast = toMdast (hast, {
258254 handlers: {
259255 svg (h , node ) {
0 commit comments