import type { DocumentMetadata } from './types.js'; export interface ParsedFrontmatter { metadata: DocumentMetadata; content: string; /** Character offset in the original markdown where `content` begins. */ contentOffset: number; /** Source range of every top-level field's value (quotes excluded), keyed * by field name — what a design element such as `{title}` maps back to. * Absent when there is no frontmatter block. */ fieldSources?: Record; /** Set when the block does not parse (YAML a reader is still typing, an * unclosed quote): `metadata` is then empty and `content` is the text * after the block's closing line, as with a block that parses. */ error?: FrontmatterError; } /** Why a front-matter block could not be read, and where it is. */ export interface FrontmatterError { /** The parser's reason, with the line and column it stopped at * (`unexpected end of the stream within a double quoted scalar (3:1)`). */ message: string; /** The block's source range, from its opening `---` to the end of its * closing line (or of the text, when it is never closed). */ sourceStart: number; sourceEnd: number; } /** Offsets of the `key: value` values of a frontmatter block: line 1 is the * opening `---`, the block ends at the next `---` line; a value is what * follows the first colon, trimmed, minus surrounding quotes. */ export declare function frontmatterFieldSources(markdown: string): Record | undefined; /** * The locale a date is written in for a document in `locale`: the tag * itself, with two Unicode extensions added where it names none. * - Arabic is pinned to the Gregorian calendar (`-u-ca-gregory`): a runtime * may default a region to the Hijri one (`ar-SA` to Umm al-Qura in some * ICU versions), and a book prints the date its front matter gives. A tag * that names a calendar keeps it: `ar-u-ca-islamic` writes * `23 ربيع الآخر 1448 هـ`. * - `numberingSystem` (`'arab'`, `'latn'`…), when given, sets the digits — * the hook for the document's digit system, so a date's digits follow the * page numbers' (`٤ أكتوبر ٢٠٢٦` where those are Arabic-Indic). A tag * that names its digits (`ar-EG-u-nu-latn`) keeps them; with neither, the * runtime's default for the tag applies (bare `ar`: 0–9; `ar-EG`: ٠–٩). * A tag the runtime rejects is returned as given. */ export declare function dateLocaleOf(locale: string, numberingSystem?: string): string; /** * The text a metadata value prints as. YAML frontmatter is typed — * `title: 1984` parses as a number, `publishDate: 2026-09-24` as a `Date`, * `author: [Ana, Luis]` as a list — so a value is coerced rather than * dropped: strings as they are, numbers and booleans as written, a date as * its calendar day (long form in `locale` — see {@link dateLocaleOf} for * the calendar and the digits, which `numberingSystem` may set — ISO * `YYYY-MM-DD` without one), a list as its items joined by `, ` (`، ` in * an Arabic-script language). `undefined` for anything else (an object, * `null`, an invalid date). */ export declare function metadataText(value: unknown, locale?: string, numberingSystem?: string): string | undefined; /** `metadata` with the printed fields (`title`, `subtitle`, `author`, * `publishDate`) coerced to text by {@link metadataText}; a field that has * no text form is dropped. Other keys are kept as parsed. `numberingSystem` * sets the digits of a date (see {@link dateLocaleOf}). */ export declare function normalizeMetadata(metadata: DocumentMetadata, locale?: string, numberingSystem?: string): DocumentMetadata; /** * The front matter of `markdown` and the text after it. Never throws: a * block that does not parse (YAML being typed, an unclosed quote) gives no * metadata, the text after the block as `content`, and the reason in * `error` — `collectContentWarnings` reports it as `invalidFrontmatter`. */ export declare function extractFrontmatter(markdown: string): ParsedFrontmatter; //# sourceMappingURL=frontmatter.d.ts.map