import { type SrcbookMetadataType } from '@srcbook/shared'; import type { Tokens, Token } from 'marked'; import type { CellType, CodeCellType, MarkdownCellType, PackageJsonCellType, TitleCellType } from '@srcbook/shared'; export declare function encode(cells: CellType[], metadata: SrcbookMetadataType, options: { inline: boolean; }): string; export declare function encodeTitleCell(cell: TitleCellType): string; export declare function encodeMarkdownCell(cell: MarkdownCellType): string; export declare function encodePackageJsonCell(cell: PackageJsonCellType, options: { inline: boolean; }): string; export declare function encodeCodeCell(cell: CodeCellType, options: { inline: boolean; }): string; export type DecodeErrorResult = { error: true; errors: string[]; }; export type DecodeSuccessResult = { error: false; cells: CellType[]; metadata: SrcbookMetadataType; }; export type DecodeResult = DecodeErrorResult | DecodeSuccessResult; export declare function decode(contents: string): DecodeResult; /** * Decode a compatible directory into a set of cells. * * The directory must contain a README.md file and a package.json file. * We assume the README.md file contains the srcbook content, in particular * the first 2 cells should be a title cell and then a package.json.cell * * We leverage the decode() function first to decode the README.md file, and then * we replace the contents of the referenced package.json and code files into the cells. */ export declare function decodeDir(dir: string): Promise; type TitleGroupType = { type: 'title'; token: Tokens.Heading; }; type FilenameGroupType = { type: 'filename'; token: Tokens.Heading; }; type CodeGroupType = { type: 'code'; token: Tokens.Code; }; type LinkedCodeGroupType = { type: 'code:linked'; token: Tokens.Link; }; type MarkdownGroupType = { type: 'markdown'; tokens: Token[]; }; type GroupedTokensType = TitleGroupType | FilenameGroupType | CodeGroupType | MarkdownGroupType | LinkedCodeGroupType; /** * Group tokens into an intermediate representation. */ export declare function groupTokens(tokens: Token[]): GroupedTokensType[]; export {}; //# sourceMappingURL=srcmd.d.mts.map