import { VFile } from 'vfile'; import type { GenericParent } from 'myst-common'; import { RuleId } from 'myst-common'; import type { PageFrontmatter } from 'myst-frontmatter'; import { SourceFileKind } from 'myst-spec-ext'; import type { ISession } from '../session/types.js'; import type { PreRendererData, RendererData } from '../transforms/types.js'; import type { ValidationOptions } from 'simple-validators'; type LoadFileOptions = { preFrontmatter?: Record; keepTitleNode?: boolean; kind?: SourceFileKind; }; export type LoadFileResult = { kind: SourceFileKind; mdast: GenericParent; frontmatter?: PageFrontmatter; identifiers?: string[]; widgets?: Record; }; export declare function loadMdFile(session: ISession, content: string, file: string, opts?: LoadFileOptions): LoadFileResult; export declare function loadNotebookFile(session: ISession, content: string, file: string, opts?: LoadFileOptions): Promise; export declare function loadTexFile(session: ISession, content: string, file: string, opts?: LoadFileOptions): LoadFileResult; export declare function mystJSONValidationOpts(vfile: VFile, opts?: { property?: string; ruleId?: RuleId; }): ValidationOptions; export declare function loadMySTJSON(session: ISession, content: string, file: string, opts?: LoadFileOptions): { mdast: GenericParent; kind: SourceFileKind; frontmatter: PageFrontmatter; identifiers: string[]; }; /** * Attempt to load a file into the current session. Unsupported files with * issue a warning * * @param session session with logging * @param file path to file to load * @param projectPath path to project directory * @param extension pre-computed file extension * @param opts loading options * * @param opts.preFrontmatter raw page frontmatter, prioritized over frontmatter * read from the file. Fields defined here will override fields defined * in the file. Unlike project and page frontmatter which are carefully * combined to maintain affiliations, keep all math macros, etc, this * override simply replaces fields prior to any further processing or * validation. */ export declare function loadFile(session: ISession, file: string, projectPath?: string, extension?: '.md' | '.ipynb' | '.tex' | '.bib' | '.myst.json', opts?: LoadFileOptions): Promise; /** * Load and process frontmatter parts (e.g., footer, sidebar) from various sources. * * Parts can be a few things in the frontmatter: * - Remote URLs (https://example.com/footer.md) - fetched and cached locally * - Local file paths (footer.md) - loaded relative to the config file * - Inline content (e.g. `footer: Foo *bar*.`) - parsed and cached using a synthetic path so we can refer to it * * Returns a modified parts object where each part value is replaced with the * resolved file path (or synthetic path for inline content). */ export declare function loadFrontmatterParts(session: ISession, file: string, property: string, frontmatter: PageFrontmatter, projectPath?: string): Promise<{ [k: string]: string[]; }>; /** * Find bibliography files in the given directory, loading them if required * * @param session session with logging * @param dir directory to search * @param load load bib files in addition to locating them */ export declare function bibFilesInDir(session: ISession, dir: string, load?: boolean): Promise; /** * Return the cached post-processed MDAST for the given file, or return undefined * * @param session session with logging * @param file path to file */ export declare function selectFile(session: ISession, file: string): RendererData | undefined; export declare function getRawFrontmatterFromFile(session: ISession, file: string, projectPath?: string): Promise; export {}; //# sourceMappingURL=file.d.ts.map