markdown-code-example-inserter
Version:
Syncs code examples with markdown documentation.
13 lines (12 loc) • 603 B
TypeScript
import type { Node, Parent } from 'unist';
export type WalkLanguages = 'markdown' | 'html';
/**
* Fire callback on node and all children of node recursively.
*
* @param node The starting node
* @param callback The callback to handle the node. If this returns something truthy, then the
* walking is immediately aborted.
* @returns True is walking was aborted early due to the callback returning true for a node, false
* if it was not aborted.
*/
export declare function walk(node: Node | Parent, language: WalkLanguages, callback: (node: Node, language: WalkLanguages) => unknown): boolean;