Skip to content

Commit 3b32779

Browse files
committed
fix
1 parent 8078a9b commit 3b32779

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/node/markdown/markdown.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
import { sfcPlugin, type SfcPluginOptions } from '@mdit-vue/plugin-sfc'
1414
import { titlePlugin } from '@mdit-vue/plugin-title'
1515
import { tocPlugin, type TocPluginOptions } from '@mdit-vue/plugin-toc'
16-
import { slugify } from '@mdit-vue/shared'
16+
import { slugify as defaultSlugify } from '@mdit-vue/shared'
1717
import type {
1818
LanguageInput,
1919
ShikiTransformer,
@@ -232,6 +232,8 @@ export async function createMarkdownRenderer(
232232
await options.preConfig(md)
233233
}
234234

235+
const slugify = options.anchor?.slugify ?? defaultSlugify
236+
235237
// custom plugins
236238
md.use(componentPlugin, { ...options.component })
237239
.use(highlightLinePlugin)
@@ -243,7 +245,7 @@ export async function createMarkdownRenderer(
243245
linkPlugin,
244246
{ target: '_blank', rel: 'noreferrer', ...options.externalLinks },
245247
base,
246-
options.anchor?.slugify ?? slugify
248+
slugify
247249
)
248250
.use(lineNumberPlugin, options.lineNumbers)
249251

@@ -318,6 +320,7 @@ export async function createMarkdownRenderer(
318320
} as SfcPluginOptions)
319321
.use(titlePlugin)
320322
.use(tocPlugin, {
323+
slugify,
321324
...options.toc
322325
} as TocPluginOptions)
323326

0 commit comments

Comments
 (0)