fumadocs-core
Version:
The React.js library for building a documentation website
77 lines (76 loc) • 2.33 kB
TypeScript
import { PluggableList, Transformer } from "unified";
import { Nodes, Root } from "mdast";
import { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement } from "mdast-util-mdx-jsx";
//#region src/mdx-plugins/remark-structure.d.ts
interface Heading$1 {
id: string;
content: string;
}
interface Content {
heading: string | undefined;
content: string;
}
interface StructuredData {
headings: Heading$1[];
/**
* Refer to paragraphs, a heading may contain multiple contents as well
*/
contents: Content[];
}
interface StructureOptions {
/**
* Types to be scanned as content.
*
* @defaultValue ['heading', 'paragraph', 'blockquote', 'tableCell', 'mdxJsxFlowElement']
*/
types?: string[] | ((node: Nodes) => boolean);
/**
* A list of indexable MDX attributes, either:
*
* - an array of attribute names.
* - a function that determines if attribute should be indexed.
*/
allowedMdxAttributes?: string[] | ((node: MdxJsxFlowElement, attribute: MdxJsxAttribute | MdxJsxExpressionAttribute) => boolean);
/**
* export as `structuredData` or specified variable name.
*/
exportAs?: string | boolean;
}
declare module 'mdast' {
interface Data {
/**
* [Fumadocs] Get content of unserializable element, `remarkStructure` uses it to generate search index.
*/
_string?: string[];
}
}
declare module 'vfile' {
interface DataMap {
/**
* [Fumadocs] injected by `remarkStructure`
*/
structuredData: StructuredData;
}
}
declare const remarkStructureDefaultOptions: {
types: string[];
allowedMdxAttributes: (node: MdxJsxFlowElement) => boolean;
exportAs: false;
};
/**
* Extract content into structured data.
*
* By default, the output is stored into VFile (`vfile.data.structuredData`), you can specify `exportAs` to export it.
*/
declare function remarkStructure({
types,
allowedMdxAttributes,
exportAs
}?: StructureOptions): Transformer<Root, Root>;
/**
* Extract data from markdown/mdx content
*/
declare function structure(content: string, remarkPlugins?: PluggableList, options?: StructureOptions): StructuredData;
//#endregion
export { structure as a, remarkStructureDefaultOptions as i, StructuredData as n, remarkStructure as r, StructureOptions as t };
//# sourceMappingURL=remark-structure-RZD2gGKp.d.ts.map