Home / Function/ safeParseFrontmatter() — astro Function Reference

safeParseFrontmatter() — astro Function Reference

Architecture documentation for the safeParseFrontmatter() function in utils.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  193bc04e_e61e_1162_4aaa_3aea5ef436bf["safeParseFrontmatter()"]
  94e194e3_4b35_e84e_8c7f_bf8cfbd08572["utils.ts"]
  193bc04e_e61e_1162_4aaa_3aea5ef436bf -->|defined in| 94e194e3_4b35_e84e_8c7f_bf8cfbd08572
  style 193bc04e_e61e_1162_4aaa_3aea5ef436bf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/mdx/src/utils.ts lines 51–65

export function safeParseFrontmatter(code: string, id: string) {
	try {
		return parseFrontmatter(code, { frontmatter: 'empty-with-spaces' });
	} catch (e: any) {
		if (e.name === 'YAMLException') {
			const err: SSRError = e;
			err.id = id;
			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

Frequently Asked Questions

What does safeParseFrontmatter() do?
safeParseFrontmatter() is a function in the astro codebase, defined in packages/integrations/mdx/src/utils.ts.
Where is safeParseFrontmatter() defined?
safeParseFrontmatter() is defined in packages/integrations/mdx/src/utils.ts at line 51.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free