UNPKG

1.52 kBTypeScriptView Raw
1import { MermaidConfig } from '../config.type.js';
2import type { DiagramDetector, DiagramLoader, ExternalDiagramDefinition } from './types.js';
3/**
4 * Detects the type of the graph text.
5 *
6 * Takes into consideration the possible existence of an `%%init` directive
7 *
8 * @param text - The text defining the graph. For example:
9 *
10 * ```mermaid
11 * %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%%
12 * graph LR
13 * a-->b
14 * b-->c
15 * c-->d
16 * d-->e
17 * e-->f
18 * f-->g
19 * g-->h
20 * ```
21 *
22 * @param config - The mermaid config.
23 * @returns A graph definition key
24 */
25export declare const detectType: (text: string, config?: MermaidConfig) => string;
26/**
27 * Registers lazy-loaded diagrams to Mermaid.
28 *
29 * The diagram function is loaded asynchronously, so that diagrams are only loaded
30 * if the diagram is detected.
31 *
32 * @remarks
33 * Please note that the order of diagram detectors is important.
34 * The first detector to return `true` is the diagram that will be loaded
35 * and used, so put more specific detectors at the beginning!
36 *
37 * @param diagrams - Diagrams to lazy load, and their detectors, in order of importance.
38 */
39export declare const registerLazyLoadedDiagrams: (...diagrams: ExternalDiagramDefinition[]) => void;
40export declare const loadRegisteredDiagrams: () => Promise<void>;
41export declare const addDetector: (key: string, detector: DiagramDetector, loader?: DiagramLoader) => void;
42export declare const getDiagramLoader: (key: string) => DiagramLoader | undefined;