UNPKG

@builder.io/dev-tools

Version:

Builder.io Visual CMS Devtools

33 lines (32 loc) 1.12 kB
/** * Generic YAML frontmatter parser for Markdown files * Supports both simple key-value pairs and arrays */ export interface YamlFrontmatterResult<T = Record<string, any>> { frontmatter: T; body: string; } /** * Checks if content has YAML frontmatter */ export declare function hasYamlFrontmatter(content: string): boolean; /** * Parses YAML frontmatter from a string * Handles simple YAML: key-value pairs, arrays, and comments */ export declare function parseYamlFrontmatter(yamlContent: string): Record<string, any>; /** * Extracts YAML frontmatter and body from Markdown content * @param content - The raw Markdown content with frontmatter * @returns Object with frontmatter and body, or null if no frontmatter found */ export declare function extractYamlFrontmatter(content: string): { frontmatterContent: string; body: string; } | null; /** * Parse Markdown file with YAML frontmatter * @param content - The raw file content * @returns Parsed frontmatter and body */ export declare function parseMarkdownWithYaml<T = Record<string, any>>(content: string): YamlFrontmatterResult<T>;