@@ -29,7 +29,8 @@ import type { LoadContext } from "@docusaurus/types";
2929import {
3030 aliasedSitePath ,
3131 normalizeUrl ,
32- parseMarkdownString ,
32+ parseMarkdownFile ,
33+ DEFAULT_PARSE_FRONT_MATTER ,
3334} from "@docusaurus/utils" ;
3435
3536import { validateDocFrontMatter } from "./frontMatter" ;
@@ -78,11 +79,16 @@ async function doProcessDocMetadata({
7879 const { siteDir } = context ;
7980
8081 const {
81- frontMatter : unsafeFrontMatter ,
82- contentTitle,
83- excerpt,
84- } = parseMarkdownString ( content ) ;
85- const frontMatter = validateDocFrontMatter ( unsafeFrontMatter ) ;
82+ frontMatter : parsedFrontMatter ,
83+ contentTitle : parsedContentTitle ,
84+ excerpt : parsedExcerpt ,
85+ } = await parseMarkdownFile ( {
86+ fileContent : content ,
87+ filePath,
88+ parseFrontMatter : DEFAULT_PARSE_FRONT_MATTER ,
89+ } ) ;
90+
91+ const frontMatter = validateDocFrontMatter ( parsedFrontMatter ) ;
8692
8793 // E.g. api/plugins/myDoc -> myDoc; myDoc -> myDoc
8894 const sourceFileNameWithoutExtension = path . basename (
@@ -129,9 +135,9 @@ async function doProcessDocMetadata({
129135 // Note: the title is used by default for page title, sidebar label,
130136 // pagination buttons... frontMatter.title should be used in priority over
131137 // contentTitle (because it can contain markdown/JSX syntax)
132- const title : string = frontMatter . title ?? contentTitle ?? baseID ;
138+ const title : string = frontMatter . title ?? parsedContentTitle ?? baseID ;
133139
134- const description : string = frontMatter . description ?? excerpt ?? "" ;
140+ const description : string = frontMatter . description ?? parsedExcerpt ?? "" ;
135141
136142 const permalink = normalizeUrl ( [
137143 context . baseUrl ,
0 commit comments