import type { Plugin } from "unified"; import type { PhrasingContent, Root } from "mdast"; import type { Test } from "unist-util-is"; export type Prettify = { [K in keyof T]: T[K]; } & {}; export type PartiallyRequired = Omit & Required>; export type HeadingParent = "root" | "blockquote" | "footnoteDefinition" | "listItem" | "container" | "mdxJsxFlowElement"; export type HeadingDepth = 1 | 2 | 3 | 4 | 5 | 6; export type TocItem = { value: string; content: PhrasingContent[]; href: string; depth: HeadingDepth; numbering: number[]; parent: HeadingParent; parentPath: number[]; data?: { [PropertyName: string]: string | number | boolean | (string | number)[] | null | undefined; }; }; /** * tocName (default: "toc") - the key name which is attached into vfile.data * tocRef (default: []) — another way of exposing the tocItems * maxDepth (default: 6) — max heading depth to include in the table of contents; this is inclusive: when set to 3, level three headings are included * skipLevels (default: [1]) — disallowed heading levels, by default the article h1 is not expected to be in the TOC * includeParents — allow headings to be children of certain nodes; internally uses unist-util-is Test * skipParents (default: []) — disallow headings to be children of certain nodes; internally uses unist-util-is Test * exclude — headings to skip, wrapped in new RegExp('^(' + value + ')$', 'i'); any heading matching this expression will not be present in the table of contents * prefix - the text that will be attached to headings as prefix, like "text-prefix-" * after — heading to look for, wrapped in new RegExp('^(' + value + ')$', 'i'); the TOC items will be generated after that heading section * callback - It is a callback function to take the array of toc items as an argument */ export type FlexibleTocOptions = { tocName?: string; tocRef?: TocItem[]; maxDepth?: HeadingDepth; skipLevels?: HeadingDepth[]; includeParents?: Test; skipParents?: Test; exclude?: string | string[]; prefix?: string; after?: string; callback?: (toc: TocItem[]) => undefined; }; export type GenerateTocItemsOptions = Pick; export declare function generateTocItemsFromMdast(tree: Root, options?: GenerateTocItemsOptions): TocItem[]; declare const RemarkFlexibleToc: Plugin<[FlexibleTocOptions?], Root>; export default RemarkFlexibleToc; //# sourceMappingURL=index.d.ts.map