UNPKG

1.09 kBTypeScriptView Raw
1import { DetailedError } from './utils.js';
2export type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void;
3/**
4 * An object representing a parsed mermaid diagram definition.
5 * @privateRemarks This is exported as part of the public mermaidAPI.
6 */
7export declare class Diagram {
8 text: string;
9 type: string;
10 parser: any;
11 renderer: any;
12 db: import("./diagram-api/types.js").DiagramDb;
13 private detectError?;
14 constructor(text: string);
15 parse(): void;
16 render(id: string, version: string): Promise<void>;
17 getParser(): any;
18 getType(): string;
19}
20/**
21 * Parse the text asynchronously and generate a Diagram object asynchronously.
22 * **Warning:** This function may be changed in the future.
23 * @alpha
24 * @param text - The mermaid diagram definition.
25 * @returns A the Promise of a Diagram object.
26 * @throws {@link UnknownDiagramError} if the diagram type can not be found.
27 * @privateRemarks This is exported as part of the public mermaidAPI.
28 */
29export declare const getDiagramFromText: (text: string) => Promise<Diagram>;