fumadocs-core
Version:
The React.js library for building a documentation website
34 lines • 1.03 kB
TypeScript
import { Transformer } from "unified";
import { Root, RootContent } from "mdast";
export interface RemarkBlockIdOptions {
/**
* generate block ID.
*/
generateId?: (ctx: {
node: RootContent;
text: string;
}) => string;
/**
* determine whether an ID should be generated for a given node.
*
* default: `true` for block nodes, otherwise `false`.
*
* @returns
* - `true`: generate an ID for the node.
* - `false`: skip the current node and look into its children.
* - `skip`: skip the current node and its children.
*/
shouldGenerate?: (node: RootContent) => boolean | 'skip';
/**
* Add `data-block="<value>"` to updated nodes, pass `null` to disable.
*
* @default "default"
*/
addDataAttribute?: string | null;
}
/**
* Generate ID for each block node in Markdown/MDX.
*
* Note: the uniqueness is only guaranteed per file.
*/
export declare function remarkBlockId({ generateId, addDataAttribute, shouldGenerate }?: RemarkBlockIdOptions): Transformer<Root, Root>;