@@ -85,14 +85,12 @@ Say we have the following `example.html`:
85
85
86
86
``` js
87
87
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'
90
89
import {toMdast } from ' hast-util-to-mdast'
91
90
import {toMarkdown } from ' mdast-util-to-markdown'
92
91
93
92
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 })
96
94
const mdast = toMdast (hast)
97
95
const markdown = toMarkdown (mdast)
98
96
@@ -245,15 +243,13 @@ This can be achieved with `example.js` like so:
245
243
246
244
``` js
247
245
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'
250
247
import {toMdast } from ' hast-util-to-mdast'
251
248
import {toHtml } from ' hast-util-to-html'
252
249
import {toMarkdown } from ' mdast-util-to-markdown'
253
250
254
251
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 })
257
253
const mdast = toMdast (hast, {
258
254
handlers: {
259
255
svg (h , node ) {
0 commit comments