Skip to content

Commit c472e5a

Browse files
committed
Remove dev-dependency
1 parent dbb8c51 commit c472e5a

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

example.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@ import {inspect} from 'node:util'
66
* @typedef {import('mdast').Root} Root
77
*/
88

9-
import {u} from 'unist-builder'
109
import {toc} from './index.js'
1110

1211
// Now running:
13-
const tree = /** @type {Root} */ (
14-
u('root', [
15-
u('heading', {depth: 1}, [u('text', 'Alpha')]),
16-
u('heading', {depth: 2}, [u('text', 'Bravo')]),
17-
u('heading', {depth: 3}, [u('text', 'Charlie')]),
18-
u('heading', {depth: 2}, [u('text', 'Delta')])
19-
])
20-
)
12+
/** @type {Root} */
13+
const tree = {
14+
type: 'root',
15+
children: [
16+
{type: 'heading', depth: 1, children: [{type: 'text', value: 'Alpha'}]},
17+
{type: 'heading', depth: 2, children: [{type: 'text', value: 'Bravo'}]},
18+
{type: 'heading', depth: 3, children: [{type: 'text', value: 'Charlie'}]},
19+
{type: 'heading', depth: 2, children: [{type: 'text', value: 'Delta'}]}
20+
]
21+
}
2122

2223
const table = toc(tree)
2324

readme.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,22 @@ Dependencies:
7171
* @typedef {import('mdast').Root} Root
7272
*/
7373

74-
import {u} from 'unist-builder'
7574
import {toc} from 'mdast-util-toc'
7675
```
7776

7877
Now running:
7978

8079
```javascript
81-
const tree = /** @type {Root} */ (
82-
u('root', [
83-
u('heading', {depth: 1}, [u('text', 'Alpha')]),
84-
u('heading', {depth: 2}, [u('text', 'Bravo')]),
85-
u('heading', {depth: 3}, [u('text', 'Charlie')]),
86-
u('heading', {depth: 2}, [u('text', 'Delta')])
87-
])
88-
)
80+
/** @type {Root} */
81+
const tree = {
82+
type: 'root',
83+
children: [
84+
{type: 'heading', depth: 1, children: [{type: 'text', value: 'Alpha'}]},
85+
{type: 'heading', depth: 2, children: [{type: 'text', value: 'Bravo'}]},
86+
{type: 'heading', depth: 3, children: [{type: 'text', value: 'Charlie'}]},
87+
{type: 'heading', depth: 2, children: [{type: 'text', value: 'Delta'}]}
88+
]
89+
}
8990

9091
const table = toc(tree)
9192
```

0 commit comments

Comments
 (0)