UNPKG

1.07 kBTypeScriptView Raw
1import '../../';
2
3declare module '../../' {
4 /**
5 * Runs a CodeMirror mode over text without opening an editor instance.
6 *
7 * @param text The document to run through the highlighter.
8 * @param mode The mode to use (must be loaded as normal).
9 * @param callback If this is a function, it will be called for each token with
10 * five arguments, the token's text, the token's style class (may be null for unstyled tokens),
11 * the number of row of the token, the column position of token and the state of mode.
12 * If it is a DOM node, the tokens will be converted to span elements as in an editor,
13 * and inserted into the node (through innerHTML).
14 */
15 function runMode(
16 text: string,
17 mode: string | ModeSpec<unknown>,
18 callback:
19 | HTMLElement
20 | ((text: string, style?: string | null, row?: number, column?: number, state?: any) => void),
21 options?: { tabSize?: number | undefined; state?: any },
22 ): void;
23}