import { Element, Root } from 'xast'; /** * Return `sourceContent` with every xi:include replaced by the contents of * the referenced files. `sourcePath` anchors relative hrefs; `projectDir` * bounds which files may be included. */ export declare function resolveXIncludes(sourceContent: string, sourcePath: string, projectDir: string): Promise; /** Result of resolveXIncludesToTree. */ export interface ResolvedTree { /** * The merged xast tree. Every node keeps the line/column position of its * OWN source file's parse, and the root element of each spliced-in subtree * is tagged with that file (see includedFileOf) — together, enough to map * any element back to a file and line (see computeSourceMap). */ tree: Root; /** The merged document serialized, as resolveXIncludes would return it. */ content: string; } /** * Like resolveXIncludes, but also return the merged tree with per-file * position attribution, for source-map computation. */ export declare function resolveXIncludesToTree(sourceContent: string, sourcePath: string, projectDir: string): Promise; /** * File a spliced-in element was parsed from, tagged by expandInclude. * Undefined for nodes of the file being resolved (callers track that file * themselves). Stored on the unist `data` field, which serializers ignore. */ export declare function includedFileOf(element: Element): string | undefined; /** * Extract the `` element from a complete PreTeXt source file as an XML * string, resolving xi:includes along the way. Handles the two shapes authors * actually write: a literal `` (whose children may themselves be * xi:included — e.g. a factored-out macros file), and a top-level * `` standing in for the whole docinfo. * * Only the docinfo is resolved: scanning stops at the document element * (/
/…), which `` must precede, so the book's chapter * includes are never read. Best-effort — returns undefined when there is no * docinfo, or if resolution fails (a fragment preview without the project * macros beats a failed render). `mainPath` anchors relative hrefs; * `projectDir` bounds which files may be read. */ export declare function extractDocinfo(mainContent: string, mainPath: string, projectDir: string): Promise;