Home / Function/ editShouldBeInFrontmatter() — astro Function Reference

editShouldBeInFrontmatter() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  6d8bf803_df4a_6ab2_9c5d_83b2d0d83b6b["editShouldBeInFrontmatter()"]
  839dada7_8bd4_2ee4_9498_f38d21d2f7e9["utils.ts"]
  6d8bf803_df4a_6ab2_9c5d_83b2d0d83b6b -->|defined in| 839dada7_8bd4_2ee4_9498_f38d21d2f7e9
  style 6d8bf803_df4a_6ab2_9c5d_83b2d0d83b6b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/language-tools/language-server/src/plugins/utils.ts lines 149–161

export function editShouldBeInFrontmatter(
	range: Range,
	astroMetadata: AstroMetadata,
): FrontmatterEditValidity {
	const isAtTSXStart = range.start.line < astroMetadata.tsxRanges.frontmatter.start.line;

	const isPastFile = range.start.line > astroMetadata.tsxRanges.body.end.line;
	const shouldIt = isAtTSXStart || isPastFile;

	return shouldIt
		? { itShould: true, position: isPastFile ? 'bottom' : 'top' }
		: { itShould: false, position: undefined };
}

Domain

Subdomains

Frequently Asked Questions

What does editShouldBeInFrontmatter() do?
editShouldBeInFrontmatter() is a function in the astro codebase, defined in packages/language-tools/language-server/src/plugins/utils.ts.
Where is editShouldBeInFrontmatter() defined?
editShouldBeInFrontmatter() is defined in packages/language-tools/language-server/src/plugins/utils.ts at line 149.

Analyze Your Own Codebase

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

Try Supermodel Free