import type { Root } from 'mdast'; import type { DocumentStructure } from './mdx/schema.ts'; export interface DossierDocument { /** * Document filename. * @example "guide" // from "01-guide.mdx" */ name: string; /** * URL-friendly document path derived from the file location. * @example "/docs/guide" */ path: string; /** * Extracted frontmatter title */ title?: string; /** * Extracted frontmatter description */ description?: string; /** * Document content containing both raw source and compiled output. */ content: { /** Raw markdown/MDX content including frontmatter */ raw: string; /** Compiled MDX JavaScript function body */ code: string; /** Parsed mdast AST */ ast: Root; }; /** * Parsed and validated frontmatter data * (e.g., icons, badges, categories, ordering) */ matter: DocumentMatter; /** * Parsed document structure containing headings, code blocks, * JSX components, images, links, lists, paragraphs, and tables. */ structure: DocumentStructure; /** * Last modification date of the source file. */ modifiedAt?: Date; /** * Size of the document's raw content in bytes. */ size: number; /** * Hierarchical table of contents built from document headings. */ toc: TocItem[]; } export type DocumentMatter = BaseMatter; export type BaseMatter = { toc: boolean; title?: string; description?: string; icon?: string; }; export interface TocItem { /** * The ID of the heading */ id: string; /** * The text content of the heading * @example "Introduction to APIs" */ value: string; /** * The href for the heading. * @example "#introduction-to-apis" */ href: string; /** * The nesting depth of the heading (1 for h1, 2 for h2, etc.) * @example 2 */ depth: number; /** * Optional nested child headings */ children?: TocItem[]; }