|
6 | 6 |
|
7 | 7 | import assert from 'node:assert' |
8 | 8 | import test from 'tape' |
9 | | -import {remark} from 'remark' |
| 9 | +import {fromMarkdown} from 'mdast-util-from-markdown' |
10 | 10 | import {VFile} from 'vfile' |
11 | 11 | import {source} from './index.js' |
12 | 12 |
|
13 | 13 | test('unist-util-source', (t) => { |
14 | 14 | let file = new VFile('> + **[Hello](./example)**\n> world.') |
15 | 15 | /** @type {Node} */ |
16 | | - let node = remark().parse(file) |
| 16 | + let node = fromMarkdown(String(file)) |
17 | 17 |
|
18 | 18 | t.equal(source(node, file), '> + **[Hello](./example)**\n> world.', 'root') |
19 | 19 |
|
@@ -60,28 +60,28 @@ test('unist-util-source', (t) => { |
60 | 60 | t.equal(source(null, file), null, 'missing') |
61 | 61 |
|
62 | 62 | file = new VFile('a\r\nb') |
63 | | - node = remark().parse(file) |
| 63 | + node = fromMarkdown(String(file)) |
64 | 64 | assert(node.type === 'root') |
65 | 65 | node = node.children[0] |
66 | 66 | assert(node.type === 'paragraph') |
67 | 67 |
|
68 | 68 | t.equal(source(node, file), 'a\r\nb', 'cr + lf') |
69 | 69 |
|
70 | 70 | file = new VFile('a\rb') |
71 | | - node = remark().parse(file) |
| 71 | + node = fromMarkdown(String(file)) |
72 | 72 | assert(node.type === 'root') |
73 | 73 | node = node.children[0] |
74 | 74 | assert(node.type === 'paragraph') |
75 | 75 |
|
76 | 76 | t.equal(source(node, file), 'a\rb', 'cr') |
77 | 77 |
|
78 | 78 | file = new VFile('a\n') |
79 | | - node = remark().parse(file) |
| 79 | + node = fromMarkdown(String(file)) |
80 | 80 |
|
81 | 81 | t.equal(source(node, file), 'a\n', 'eof eol') |
82 | 82 |
|
83 | 83 | file = new VFile('a\n\rb') |
84 | | - node = remark().parse(file) |
| 84 | + node = fromMarkdown(String(file)) |
85 | 85 |
|
86 | 86 | t.equal(source(node, file), 'a\n\rb', 'blank lines') |
87 | 87 |
|
|
0 commit comments