@@ -13,10 +13,12 @@ import {
1313 addTrailingPathSeparator ,
1414 createAbsoluteFilePathMatcher ,
1515 getContentPathList ,
16+ resolveMarkdownLinkPathname ,
1617} from '@docusaurus/utils' ;
1718import { createMDXLoaderRule } from '@docusaurus/mdx-loader' ;
1819import { createAllRoutes } from './routes' ;
1920import { createPagesContentPaths , loadPagesContent } from './content' ;
21+ import { createContentHelpers } from './contentHelpers' ;
2022import type { LoadContext , Plugin } from '@docusaurus/types' ;
2123import type {
2224 PluginOptions ,
@@ -32,6 +34,7 @@ export default async function pluginContentPages(
3234 const { siteConfig, siteDir, generatedFilesDir} = context ;
3335
3436 const contentPaths = createPagesContentPaths ( { context, options} ) ;
37+ const contentHelpers = createContentHelpers ( ) ;
3538
3639 const pluginDataDirRoot = path . join (
3740 generatedFilesDir ,
@@ -82,6 +85,14 @@ export default async function pluginContentPages(
8285 image : frontMatter . image ,
8386 } ) ,
8487 markdownConfig : siteConfig . markdown ,
88+ resolveMarkdownLink : ( { linkPathname, sourceFilePath} ) => {
89+ return resolveMarkdownLinkPathname ( linkPathname , {
90+ sourceFilePath,
91+ sourceToPermalink : contentHelpers . sourceToPermalink ,
92+ siteDir,
93+ contentPaths,
94+ } ) ;
95+ } ,
8596 } ,
8697 } ) ;
8798 }
@@ -109,6 +120,7 @@ export default async function pluginContentPages(
109120 if ( ! content ) {
110121 return ;
111122 }
123+ contentHelpers . updateContent ( content ) ;
112124 await createAllRoutes ( { content, options, actions} ) ;
113125 } ,
114126
0 commit comments