import type { LanguageSupport } from '@codemirror/language'; /** * The interface of a codemirror language spec. */ export interface ISpec { name: string; alias?: readonly string[]; mime: string | readonly string[]; load?: () => Promise; extensions?: readonly string[]; filename?: RegExp; support?: LanguageSupport; } /** * Get the raw list of available modes specs. * * @alpha * @returns The available modes */ export declare function getModeInfo(): ISpec[]; /** * Find a codemirror mode by MIME. * * @alpha * @param mime Mime type to look for * @returns The mode or null */ export declare function findByMIME(mime: string | readonly string[]): ISpec | null; /** * Find a codemirror mode by name. * * @alpha * @param name The mode name * @returns The mode or null */ export declare function findByName(name: string): ISpec | null; /** * Find a codemirror mode by extension. * * @alpha * @param ext The extension name * @returns The mode or null */ export declare function findByExtension(ext: string | readonly string[]): ISpec | null; /** * Find a codemirror mode by filename. * * @param name File name * @returns The mode or null */ export declare function findByFileName(name: string): ISpec | null; /** * Find a codemirror mode by name or CodeMirror spec. * * @alpha * @param mode The CodeMirror mode * @param fallback Whether to fallback to default mimetype spec or not * @returns The mode or null */ export declare function findBest(mode: string | ISpec, fallback?: boolean): ISpec | null; /** * Ensure a codemirror mode is available by name or Codemirror spec. * * @param mode - The mode to ensure. If it is a string, uses [findBest] * to get the appropriate spec. * * @returns A promise that resolves when the mode is available. */ export declare function ensure(mode: string | ISpec): Promise; /** * Register a new mode for CodeMirror * * @alpha * @param mode Mode to register */ export declare function registerModeInfo(mode: ISpec): void; /** * Parse and style a string. * * @alpha * @param code Code to highlight * @param mode Code mode * @param el HTML element into which the highlighted code will be inserted */ export declare function run(code: string, mode: ISpec, el: HTMLElement): void; //# sourceMappingURL=mode.d.ts.map