import { Root } from 'xast'; /** One element of the rendered document, in document order. */ export interface SourceMapEntry { /** The element's @unique-id — its HTML id when the page emits one. */ id: string; /** Absolute path of the source file the element was authored in. */ file: string; /** 1-based start line of the element in `file`. */ line: number; /** 1-based start column of the element in `file`. */ column: number; /** 1-based line of the element's closing tag in `file`. */ endLine: number; /** * Id of the nearest mapped ancestor (or the synthesized wrapper's id in * fragment mode). Lets clients fall back outward when an id does not * appear in the rendered page (not every element gets an HTML id). */ parent?: string; } /** All entries for one rendered document, in document order. */ export type PtxSourceMap = SourceMapEntry[]; /** * Compute the source map for an xinclude-merged tree (see resolveXIncludesToTree, * whose spliced subtrees are tagged with their origin file). `rootFile` is the * file the root element was authored in. `parentId`/`position` seat the walk * below a synthesized wrapper in fragment mode: a fragment wrapped as *
… has wrapper ids root-1 / root-1-1, so its content * starts at parentId "root-1-1", position 2 (after the empty <title/>). */ export declare function computeSourceMap(tree: Root, rootFile: string, options?: { parentId?: string; position?: number; }): PtxSourceMap; /** * The entry to sync to for a cursor at `line`, given the entries of ONE file * in document order (start lines are non-decreasing within a file): the last * element starting at or before the line — the deepest/nearest element above * the cursor. Falls back to the file's first entry for a cursor in the prolog. */ export declare function findSourceMapEntry(entries: PtxSourceMap, line: number): SourceMapEntry | undefined;