docs: improve references loading (#13761)

* docs: improve references loading

* remove comment

* try remove generate metadata

* improvements and fixes
This commit is contained in:
Shahed Nasser
2025-10-16 14:25:01 +03:00
committed by GitHub
parent 4eb9628514
commit e36c054780
11 changed files with 379 additions and 107 deletions

View File

@@ -28,3 +28,20 @@ export function getFrontMatterSync(filePath: string): FrontMatter {
return content.data.matter as FrontMatter
}
export async function getFrontMatterFromString(
fileContent: string
): Promise<FrontMatter> {
return (
await unified()
.use(remarkParse)
.use(remarkStringify)
.use(remarkFrontmatter, ["yaml"])
.use(() => {
return (tree, file) => {
matter(file)
}
})
.process(fileContent)
).data.matter as FrontMatter
}