@@ -6,6 +6,7 @@ import { copyCodePlugin } from 'vuepress-plugin-copy-code2'
66import { searchProPlugin } from 'vuepress-plugin-search-pro'
77import { autoCatalogPlugin } from 'vuepress-plugin-auto-catalog'
88import { shikiPlugin } from '@vuepress/plugin-shiki'
9+ import { slug as slugify } from 'github-slugger'
910
1011const __dirname = getDirname ( import . meta. url )
1112const isProd = process . env . NODE_ENV === 'production'
@@ -29,7 +30,11 @@ export default defineUserConfig({
2930 importCode : {
3031 handleImportPath : str => str
3132 . replace ( / ^ \/ / , ROOT_PATH . replace ( / (?: | \\ | \/ ) $ / , '/' ) )
32- . replace ( / ^ @ / , CURRENT_PATH ) ,
33+ . replace ( / ^ @ \/ / , CURRENT_PATH . replace ( / (?: | \\ | \/ ) $ / , '/' ) ) ,
34+ } ,
35+ anchor : {
36+ level : [ 1 , 2 , 3 , 4 , 5 , 6 ] ,
37+ slugify,
3338 } ,
3439 } ,
3540 theme : defaultTheme ( {
@@ -72,8 +77,8 @@ export default defineUserConfig({
7277 codetabs : true ,
7378 include : {
7479 resolvePath : ( file ) => {
75- if ( file . startsWith ( '@' ) )
76- return file . replace ( '@' , CURRENT_PATH )
80+ if ( file . startsWith ( '@/ ' ) )
81+ return file . replace ( / ^ @ \/ / , CURRENT_PATH )
7782 if ( file . startsWith ( '/' ) )
7883 return file . replace ( / ^ \/ / , ROOT_PATH . replace ( / (?: | \\ | \/ ) $ / , '/' ) )
7984 return file
0 commit comments