File tree 3 files changed +11
-16
lines changed 3 files changed +11
-16
lines changed Original file line number Diff line number Diff line change 1
1
/**
2
- * @typedef {import('mdast').Content } Content
2
+ * @typedef {import('mdast').Nodes } Nodes
3
3
* @typedef {import('mdast').Heading } Heading
4
- * @typedef {import('mdast').Root } Root
5
- */
6
-
7
- // To do: when `mdast` is released, use `Nodes`.
8
- /**
9
- * @typedef {Content | Root } Node
10
4
*/
11
5
12
6
import { visit } from 'unist-util-visit'
@@ -17,7 +11,7 @@ const max = 6
17
11
* Make sure that there is only one top-level heading in the document by
18
12
* adjusting headings depths accordingly.
19
13
*
20
- * @param {Node } tree
14
+ * @param {Nodes } tree
21
15
* Tree to change.
22
16
* @returns {undefined }
23
17
* Nothing.
Original file line number Diff line number Diff line change 37
37
" index.js"
38
38
],
39
39
"dependencies" : {
40
- "@types/mdast" : " ^3 .0.0" ,
41
- "unist-util-visit" : " ^4 .0.0"
40
+ "@types/mdast" : " ^4 .0.0" ,
41
+ "unist-util-visit" : " ^5 .0.0"
42
42
},
43
43
"devDependencies" : {
44
44
"@types/node" : " ^20.0.0" ,
45
45
"c8" : " ^8.0.0" ,
46
- "mdast-util-from-markdown" : " ^1.2 .0" ,
46
+ "mdast-util-from-markdown" : " ^1.0 .0" ,
47
47
"prettier" : " ^2.0.0" ,
48
48
"remark" : " ^14.0.0" ,
49
49
"remark-cli" : " ^11.0.0" ,
50
50
"remark-preset-wooorm" : " ^9.0.0" ,
51
51
"type-coverage" : " ^2.0.0" ,
52
52
"typescript" : " ^5.0.0" ,
53
- "unist-util-remove-position" : " ^4 .0.0" ,
53
+ "unist-util-remove-position" : " ^5 .0.0" ,
54
54
"xo" : " ^0.54.0"
55
55
},
56
56
"scripts" : {
Original file line number Diff line number Diff line change @@ -35,12 +35,13 @@ test('normalizeHeadings', async function (t) {
35
35
const output = await fs . readFile (
36
36
new URL ( 'fixture/' + name + '.out' , import . meta. url )
37
37
)
38
- const actual = fromMarkdown ( input )
39
- const expected = fromMarkdown ( output )
38
+ // To do: remove casts when `mdast-util-from-markdown` is released.
39
+ const actual = /** @type {Root } */ ( fromMarkdown ( input ) )
40
+ const expected = /** @type {Root } */ ( fromMarkdown ( output ) )
40
41
41
42
normalizeHeadings ( actual )
42
- removePosition ( actual , true )
43
- removePosition ( expected , true )
43
+ removePosition ( actual , { force : true } )
44
+ removePosition ( expected , { force : true } )
44
45
45
46
assert . deepEqual ( actual , expected )
46
47
} )
You can’t perform that action at this time.
0 commit comments