Skip to content

Commit 393581c

Browse files
committed
fix: fix local build errors
1 parent 5d5f9f2 commit 393581c

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/utils/markdown/plugins/collectHeadings.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { visit } from 'unist-util-visit'
22
import { toString } from 'hast-util-to-string'
3-
import type { Root } from 'hast'
43

54
import { isHeading } from './helpers'
65

@@ -10,10 +9,10 @@ export type MarkdownHeading = {
109
level: number
1110
}
1211

13-
export function rehypeCollectHeadings(initialHeadings?: MarkdownHeading[]) {
12+
export function rehypeCollectHeadings(tree, file, initialHeadings?: MarkdownHeading[]) {
1413
const headings = initialHeadings ?? []
1514

16-
return function collectHeadings(tree: Root, file: any) {
15+
return function collectHeadings(tree, file: any) {
1716
visit(tree, 'element', (node) => {
1817
if (!isHeading(node)) {
1918
return

src/utils/markdown/processor.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
rehypeParseCommentComponents,
1313
rehypeTransformCommentComponents,
1414
rehypeCollectHeadings,
15-
rehypeShikiHighlight,
1615
type MarkdownHeading,
1716
} from './plugins'
1817

@@ -63,15 +62,14 @@ export function renderMarkdown(content): MarkdownRenderResult {
6362
},
6463
})
6564
.use(rehypeSlug)
66-
.use(rehypeShikiHighlight())
6765
.use(rehypeTransformCommentComponents)
6866
.use(rehypeAutolinkHeadings, {
6967
behavior: 'wrap',
7068
properties: {
7169
className: ['anchor-heading'],
7270
},
7371
})
74-
.use(rehypeCollectHeadings(headings))
72+
.use((tree, file) => rehypeCollectHeadings(tree, file, headings))
7573

7674
const file = processor.use(rehypeStringify).processSync(content)
7775

0 commit comments

Comments
 (0)