UNPKG

@wooorm/starry-night

Version:
25 lines 1.02 kB
/** * Create a `StarryNight` that can highlight things with the given * `grammars`. * This is async to allow async loading and registering, which is currently * only used for WASM. * * @param {ReadonlyArray<Grammar>} grammars * Grammars to support. * @param {Readonly<Options> | null | undefined} [options] * Configuration (optional). * @returns * Promise that resolves to an instance which highlights with the bound * grammars. */ export function createStarryNight(grammars: ReadonlyArray<Grammar>, options?: Readonly<Options> | null | undefined): Promise<{ flagToScope: (flag: string) => string | undefined; highlight: (value: string, scope: string) => Root; missingScopes: () => ReadonlyArray<string>; register: (grammars: ReadonlyArray<Readonly<Grammar>>) => Promise<undefined>; scopes: () => ReadonlyArray<string>; }>; import type { Grammar } from './types.js'; import type { Options } from './types.js'; import type { Root } from 'hast'; //# sourceMappingURL=index.d.ts.map