@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
20 lines • 891 B
text/typescript
import type { ElementContent } from 'hast';
/**
* Removes a prefix from the beginning of highlighted HAST nodes.
*
* This function is used after syntax highlighting to remove temporary prefix text
* that was added to provide context for the highlighter. The prefix may span across
* multiple text nodes and element boundaries.
*
* @param children - The array of HAST nodes to modify
* @param prefixLength - The number of characters to remove from the beginning
*
* @example
* // Remove "type _ = " prefix from highlighted type
* const nodes = [
* { type: 'element', children: [{ type: 'text', value: 'type _ = string' }] }
* ];
* removePrefixFromHighlightedNodes(nodes, 9);
* // Result: [{ type: 'element', children: [{ type: 'text', value: 'string' }] }]
*/
export declare function removePrefixFromHighlightedNodes(children: ElementContent[], prefixLength: number): void;