prosemirror-highlight
Version:
A ProseMirror plugin to highlight code blocks
36 lines (35 loc) • 1.03 kB
TypeScript
import { Decoration } from "prosemirror-view";
import { Node } from "prosemirror-model";
//#region src/types.d.ts
interface ParserOptions {
/**
* The text content of the code block node.
*/
content: string;
/**
* The start position of the code block node.
*/
pos: number;
/**
* The language of the code block node.
*/
language?: string;
/**
* The size of the code block node.
*/
size: number;
}
/**
* A function that parses the text content of a code block node and returns an
* array of ProseMirror decorations. If the underlying syntax highlighter is
* still loading, you can return a promise that will be resolved when the
* highlighter is ready.
*/
type Parser = (options: ParserOptions) => Decoration[] | Promise<void>;
/**
* A function that extracts the language of a code block node.
*/
type LanguageExtractor = (node: Node) => string | undefined;
//#endregion
export { Parser as n, ParserOptions as r, LanguageExtractor as t };
//# sourceMappingURL=types-jXJYKXGQ.d.ts.map