UNPKG

@mdfriday/foundry

Version:

The core engine of MDFriday. Convert Markdown and shortcodes into fully themed static sites – Hugo-style, powered by TypeScript.

63 lines 1.72 kB
import { Item, Items } from "../../../../pkg/md/parser/item"; import { Iterator } from '../../../../pkg/md/parser/pagelexer'; /** * Handler function types */ export type ItemHandler = (item: Item) => Promise<void> | void; export type IterHandler = (item: Item, iter: Iterator) => Promise<void> | void; /** * Source handlers interface - defines all the handlers needed for parsing */ export interface SourceHandlers { frontMatterHandler(): ItemHandler; summaryHandler(): IterHandler; bytesHandler(): ItemHandler; shortcodeHandler(): IterHandler; } /** * Source parse info - contains parsing state and handlers */ export declare class SourceParseInfo { private source; private posMainContent; private itemsStep1; private handlers; constructor(source: Uint8Array, handlers: SourceHandlers); /** * Validate that all required handlers are provided */ private validateHandlers; /** * Check if parsing result is empty */ isEmpty(): boolean; /** * Parse the source into items */ parse(): Promise<void>; /** * Handle the parsed items using the provided handlers */ handle(): Promise<void>; /** * Get the main content position */ getMainContentPosition(): number; /** * Get the parsed items */ getItems(): Items; /** * Get the source */ getSource(): Uint8Array; /** * Create error with position information */ private createError; } /** * Factory function to create a new SourceParseInfo */ export declare function createSourceParseInfo(source: Uint8Array, handlers: SourceHandlers): SourceParseInfo; //# sourceMappingURL=parseinfo.d.ts.map