UNPKG

1.58 kBTypeScriptView Raw
1import * as CodeMirror from '../../';
2
3export interface MultiplexedInnerMode {
4 open: string;
5 close: string;
6 mode: CodeMirror.Mode<any>;
7 parseDelimiters?: boolean | undefined;
8 delimStyle?: string | undefined;
9 innerStyle?: string | undefined;
10}
11
12declare module '../../' {
13 /**
14 * Mode combinator that can be used to easily 'multiplex' between several modes.
15 * When given as first argument a mode object, and as other arguments any number of
16 * {open, close, mode [, delimStyle, innerStyle, parseDelimiters]} objects, it will return a mode object that starts parsing
17 * using the mode passed as first argument, but will switch to another mode as soon as it encounters a string that occurs in
18 * one of the open fields of the passed objects. When in a sub-mode, it will go back to the top mode again when the close
19 * string is encountered. Pass "\n" for open or close if you want to switch on a blank line.
20 *
21 * When delimStyle is specified, it will be the token style returned for the delimiter tokens (as well as [delimStyle]-open on
22 * the opening token and [delimStyle]-close on the closing token).
23 * When innerStyle is specified, it will be the token style added for each inner mode token.
24 * When parseDelimiters is true, the content of the delimiters will also be passed to the inner mode. (And delimStyle is ignored.)
25 *
26 * The outer mode will not see the content between the delimiters.
27 */
28 function multiplexingMode(outer: Mode<any>, ...others: MultiplexedInnerMode[]): Mode<any>;
29}