safeParseFrontmatter() — astro Function Reference
Architecture documentation for the safeParseFrontmatter() function in content-entry-type.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 836f9b8a_c52a_62f8_d3fc_886fcebfc903["safeParseFrontmatter()"] b46411b3_6535_0116_92ac_cd60b744df11["content-entry-type.ts"] 836f9b8a_c52a_62f8_d3fc_886fcebfc903 -->|defined in| b46411b3_6535_0116_92ac_cd60b744df11 8da81c7c_4056_9a1c_b1a1_0ac3cbab6581["getContentEntryType()"] 8da81c7c_4056_9a1c_b1a1_0ac3cbab6581 -->|calls| 836f9b8a_c52a_62f8_d3fc_886fcebfc903 style 836f9b8a_c52a_62f8_d3fc_886fcebfc903 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/integrations/markdoc/src/content-entry-type.ts lines 411–427
function safeParseFrontmatter(fileContents: string, filePath: string) {
try {
// empty with lines to preserve sourcemap location, but not `empty-with-spaces`
// because markdoc struggles with spaces
return parseFrontmatter(fileContents, { frontmatter: 'empty-with-lines' });
} catch (e: any) {
if (e.name === 'YAMLException') {
const err: Error & ViteErrorPayload['err'] = e;
err.id = filePath;
err.loc = { file: e.id, line: e.mark.line + 1, column: e.mark.column };
err.message = e.reason;
throw err;
} else {
throw e;
}
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does safeParseFrontmatter() do?
safeParseFrontmatter() is a function in the astro codebase, defined in packages/integrations/markdoc/src/content-entry-type.ts.
Where is safeParseFrontmatter() defined?
safeParseFrontmatter() is defined in packages/integrations/markdoc/src/content-entry-type.ts at line 411.
What calls safeParseFrontmatter()?
safeParseFrontmatter() is called by 1 function(s): getContentEntryType.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free