UNPKG

myst-cli

Version:
633 lines 21.3 kB
import { z } from 'zod'; import type { ISession } from '../../session/types.js'; import type { Entry as MySTEntry } from 'myst-toc'; declare const TOCTreeOptions: z.ZodObject<{ caption: z.ZodOptional<z.ZodString>; hidden: z.ZodOptional<z.ZodBoolean>; maxdepth: z.ZodOptional<z.ZodNumber>; numbered: z.ZodOptional<z.ZodBoolean>; reversed: z.ZodOptional<z.ZodBoolean>; titlesonly: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }>; /** Basic TOC Trees **/ type NoFormatSubtreeType = z.infer<typeof TOCTreeOptions> & { entries: z.infer<typeof NoFormatEntry>[]; }; type NoFormatShorthandSubtreeType = { entries: z.infer<typeof NoFormatEntry>[]; options?: z.infer<typeof TOCTreeOptions>; }; declare const NoFormatEntry: z.ZodUnion<[z.ZodIntersection<z.ZodObject<{ file: z.ZodString; title: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { file: string; title?: string | undefined; }, { file: string; title?: string | undefined; }>, z.ZodType<NoFormatShorthandSubtreeType, z.ZodTypeDef, NoFormatShorthandSubtreeType>>, z.ZodObject<z.objectUtil.extendShape<{ file: z.ZodString; title: z.ZodOptional<z.ZodString>; }, { subtrees: z.ZodArray<z.ZodType<NoFormatSubtreeType, z.ZodTypeDef, NoFormatSubtreeType>, "many">; }>, "strip", z.ZodTypeAny, { file: string; subtrees: NoFormatSubtreeType[]; title?: string | undefined; }, { file: string; subtrees: NoFormatSubtreeType[]; title?: string | undefined; }>, z.ZodObject<{ file: z.ZodString; title: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { file: string; title?: string | undefined; }, { file: string; title?: string | undefined; }>, z.ZodObject<{ url: z.ZodString; title: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { url: string; title?: string | undefined; }, { url: string; title?: string | undefined; }>, z.ZodObject<{ glob: z.ZodString; }, "strip", z.ZodTypeAny, { glob: string; }, { glob: string; }>]>; /** Article format **/ type ArticleSubtreeType = z.infer<typeof TOCTreeOptions> & { sections: z.infer<typeof ArticleEntry>[]; }; type ArticleShorthandSubtreeType = { sections: z.infer<typeof ArticleEntry>[]; options?: z.infer<typeof TOCTreeOptions>; }; declare const ArticleEntry: z.ZodUnion<[z.ZodIntersection<z.ZodObject<{ file: z.ZodString; title: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { file: string; title?: string | undefined; }, { file: string; title?: string | undefined; }>, z.ZodType<ArticleShorthandSubtreeType, z.ZodTypeDef, ArticleShorthandSubtreeType>>, z.ZodObject<z.objectUtil.extendShape<{ file: z.ZodString; title: z.ZodOptional<z.ZodString>; }, { subtrees: z.ZodArray<z.ZodType<ArticleSubtreeType, z.ZodTypeDef, ArticleSubtreeType>, "many">; }>, "strip", z.ZodTypeAny, { file: string; subtrees: ArticleSubtreeType[]; title?: string | undefined; }, { file: string; subtrees: ArticleSubtreeType[]; title?: string | undefined; }>, z.ZodObject<{ file: z.ZodString; title: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { file: string; title?: string | undefined; }, { file: string; title?: string | undefined; }>, z.ZodObject<{ url: z.ZodString; title: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { url: string; title?: string | undefined; }, { url: string; title?: string | undefined; }>, z.ZodObject<{ glob: z.ZodString; }, "strip", z.ZodTypeAny, { glob: string; }, { glob: string; }>]>; /** Book format **/ type BookOuterSubtreeType = z.infer<typeof TOCTreeOptions> & { chapters: z.infer<typeof BookEntry>[]; }; type BookInnerSubtreeType = z.infer<typeof TOCTreeOptions> & { sections: z.infer<typeof BookEntry>[]; }; type BookShorthandOuterSubtreeType = { chapters: z.infer<typeof BookEntry>[]; options?: z.infer<typeof TOCTreeOptions>; }; type BookShorthandInnerSubtreeType = { sections: z.infer<typeof BookEntry>[]; options?: z.infer<typeof TOCTreeOptions>; }; declare const BookEntry: z.ZodUnion<[z.ZodIntersection<z.ZodObject<{ file: z.ZodString; title: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { file: string; title?: string | undefined; }, { file: string; title?: string | undefined; }>, z.ZodType<BookShorthandInnerSubtreeType, z.ZodTypeDef, BookShorthandInnerSubtreeType>>, z.ZodObject<z.objectUtil.extendShape<{ file: z.ZodString; title: z.ZodOptional<z.ZodString>; }, { subtrees: z.ZodArray<z.ZodType<BookInnerSubtreeType, z.ZodTypeDef, BookInnerSubtreeType>, "many">; }>, "strip", z.ZodTypeAny, { file: string; subtrees: BookInnerSubtreeType[]; title?: string | undefined; }, { file: string; subtrees: BookInnerSubtreeType[]; title?: string | undefined; }>, z.ZodObject<{ file: z.ZodString; title: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { file: string; title?: string | undefined; }, { file: string; title?: string | undefined; }>, z.ZodObject<{ url: z.ZodString; title: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { url: string; title?: string | undefined; }, { url: string; title?: string | undefined; }>, z.ZodObject<{ glob: z.ZodString; }, "strip", z.ZodTypeAny, { glob: string; }, { glob: string; }>]>; /** TOC **/ declare const SphinxExternalTOC: z.ZodUnion<[z.ZodUnion<[z.ZodIntersection<z.ZodObject<{ root: z.ZodString; format: z.ZodLiteral<"jb-article">; defaults: z.ZodOptional<z.ZodObject<{ caption: z.ZodOptional<z.ZodString>; hidden: z.ZodOptional<z.ZodBoolean>; maxdepth: z.ZodOptional<z.ZodNumber>; numbered: z.ZodOptional<z.ZodBoolean>; reversed: z.ZodOptional<z.ZodBoolean>; titlesonly: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { root: string; format: "jb-article"; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }, { root: string; format: "jb-article"; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }>, z.ZodType<ArticleShorthandSubtreeType, z.ZodTypeDef, ArticleShorthandSubtreeType>>, z.ZodObject<z.objectUtil.extendShape<{ root: z.ZodString; format: z.ZodLiteral<"jb-article">; defaults: z.ZodOptional<z.ZodObject<{ caption: z.ZodOptional<z.ZodString>; hidden: z.ZodOptional<z.ZodBoolean>; maxdepth: z.ZodOptional<z.ZodNumber>; numbered: z.ZodOptional<z.ZodBoolean>; reversed: z.ZodOptional<z.ZodBoolean>; titlesonly: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }>>; }, { subtrees: z.ZodArray<z.ZodType<ArticleSubtreeType, z.ZodTypeDef, ArticleSubtreeType>, "many">; }>, "strict", z.ZodTypeAny, { root: string; format: "jb-article"; subtrees: ArticleSubtreeType[]; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }, { root: string; format: "jb-article"; subtrees: ArticleSubtreeType[]; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }>, z.ZodObject<{ root: z.ZodString; format: z.ZodLiteral<"jb-article">; defaults: z.ZodOptional<z.ZodObject<{ caption: z.ZodOptional<z.ZodString>; hidden: z.ZodOptional<z.ZodBoolean>; maxdepth: z.ZodOptional<z.ZodNumber>; numbered: z.ZodOptional<z.ZodBoolean>; reversed: z.ZodOptional<z.ZodBoolean>; titlesonly: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }>>; }, "strict", z.ZodTypeAny, { root: string; format: "jb-article"; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }, { root: string; format: "jb-article"; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }>]>, z.ZodUnion<[z.ZodIntersection<z.ZodObject<{ root: z.ZodString; format: z.ZodLiteral<"jb-book">; defaults: z.ZodOptional<z.ZodObject<{ caption: z.ZodOptional<z.ZodString>; hidden: z.ZodOptional<z.ZodBoolean>; maxdepth: z.ZodOptional<z.ZodNumber>; numbered: z.ZodOptional<z.ZodBoolean>; reversed: z.ZodOptional<z.ZodBoolean>; titlesonly: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { root: string; format: "jb-book"; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }, { root: string; format: "jb-book"; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }>, z.ZodType<BookShorthandOuterSubtreeType, z.ZodTypeDef, BookShorthandOuterSubtreeType>>, z.ZodObject<z.objectUtil.extendShape<{ root: z.ZodString; format: z.ZodLiteral<"jb-book">; defaults: z.ZodOptional<z.ZodObject<{ caption: z.ZodOptional<z.ZodString>; hidden: z.ZodOptional<z.ZodBoolean>; maxdepth: z.ZodOptional<z.ZodNumber>; numbered: z.ZodOptional<z.ZodBoolean>; reversed: z.ZodOptional<z.ZodBoolean>; titlesonly: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }>>; }, { parts: z.ZodArray<z.ZodType<BookOuterSubtreeType, z.ZodTypeDef, BookOuterSubtreeType>, "many">; }>, "strict", z.ZodTypeAny, { parts: BookOuterSubtreeType[]; root: string; format: "jb-book"; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }, { parts: BookOuterSubtreeType[]; root: string; format: "jb-book"; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }>, z.ZodObject<{ root: z.ZodString; format: z.ZodLiteral<"jb-book">; defaults: z.ZodOptional<z.ZodObject<{ caption: z.ZodOptional<z.ZodString>; hidden: z.ZodOptional<z.ZodBoolean>; maxdepth: z.ZodOptional<z.ZodNumber>; numbered: z.ZodOptional<z.ZodBoolean>; reversed: z.ZodOptional<z.ZodBoolean>; titlesonly: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }>>; }, "strict", z.ZodTypeAny, { root: string; format: "jb-book"; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }, { root: string; format: "jb-book"; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }>]>, z.ZodUnion<[z.ZodIntersection<z.ZodObject<{ root: z.ZodString; defaults: z.ZodOptional<z.ZodObject<{ caption: z.ZodOptional<z.ZodString>; hidden: z.ZodOptional<z.ZodBoolean>; maxdepth: z.ZodOptional<z.ZodNumber>; numbered: z.ZodOptional<z.ZodBoolean>; reversed: z.ZodOptional<z.ZodBoolean>; titlesonly: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { root: string; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }, { root: string; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }>, z.ZodType<NoFormatShorthandSubtreeType, z.ZodTypeDef, NoFormatShorthandSubtreeType>>, z.ZodObject<z.objectUtil.extendShape<{ root: z.ZodString; defaults: z.ZodOptional<z.ZodObject<{ caption: z.ZodOptional<z.ZodString>; hidden: z.ZodOptional<z.ZodBoolean>; maxdepth: z.ZodOptional<z.ZodNumber>; numbered: z.ZodOptional<z.ZodBoolean>; reversed: z.ZodOptional<z.ZodBoolean>; titlesonly: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }>>; }, { subtrees: z.ZodArray<z.ZodType<NoFormatSubtreeType, z.ZodTypeDef, NoFormatSubtreeType>, "many">; }>, "strict", z.ZodTypeAny, { root: string; subtrees: NoFormatSubtreeType[]; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }, { root: string; subtrees: NoFormatSubtreeType[]; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }>, z.ZodObject<{ root: z.ZodString; defaults: z.ZodOptional<z.ZodObject<{ caption: z.ZodOptional<z.ZodString>; hidden: z.ZodOptional<z.ZodBoolean>; maxdepth: z.ZodOptional<z.ZodNumber>; numbered: z.ZodOptional<z.ZodBoolean>; reversed: z.ZodOptional<z.ZodBoolean>; titlesonly: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }, { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; }>>; }, "strict", z.ZodTypeAny, { root: string; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }, { root: string; defaults?: { hidden?: boolean | undefined; caption?: string | undefined; maxdepth?: number | undefined; numbered?: boolean | undefined; reversed?: boolean | undefined; titlesonly?: boolean | undefined; } | undefined; }>]>]>; export type SphinxExternalTOC = z.infer<typeof SphinxExternalTOC>; export declare function validateSphinxExternalTOC(toc: unknown): SphinxExternalTOC | undefined; /** * Upgrade a sphinx-external-toc TOC into a MyST TOC */ export declare function upgradeTOC(session: ISession, data: SphinxExternalTOC): MySTEntry[]; export {}; //# sourceMappingURL=toc.d.ts.map