mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
feat: siteConfig.markdown.parseFrontMatter hook (#9624)
This commit is contained in:
parent
28e7298211
commit
affca7a9a2
27 changed files with 486 additions and 133 deletions
|
@ -15,7 +15,7 @@ import {
|
|||
getFolderContainingFile,
|
||||
getContentPathList,
|
||||
normalizeUrl,
|
||||
parseMarkdownString,
|
||||
parseMarkdownFile,
|
||||
posixPath,
|
||||
Globby,
|
||||
normalizeFrontMatterTags,
|
||||
|
@ -140,13 +140,23 @@ async function doProcessDocMetadata({
|
|||
env: DocEnv;
|
||||
}): Promise<DocMetadataBase> {
|
||||
const {source, content, contentPath, filePath} = docFile;
|
||||
const {siteDir, i18n} = context;
|
||||
const {
|
||||
siteDir,
|
||||
i18n,
|
||||
siteConfig: {
|
||||
markdown: {parseFrontMatter},
|
||||
},
|
||||
} = context;
|
||||
|
||||
const {
|
||||
frontMatter: unsafeFrontMatter,
|
||||
contentTitle,
|
||||
excerpt,
|
||||
} = parseMarkdownString(content);
|
||||
} = await parseMarkdownFile({
|
||||
filePath,
|
||||
fileContent: content,
|
||||
parseFrontMatter,
|
||||
});
|
||||
const frontMatter = validateDocFrontMatter(unsafeFrontMatter);
|
||||
|
||||
const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue