mermaid
Version:
Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.
22 lines (21 loc) • 1.18 kB
TypeScript
import type { LayoutData } from '../../types.js';
export interface ParseToLayoutDataOptions {
/**
* When true, stamp `type`, `markers` and spacing the way the diagram's own unified renderer
* does before it calls `render()` (e.g. `flowRenderer-v3-unified.ts`, `erRenderer-unified.ts`).
*/
stampRendererFields?: boolean;
/**
* Config applied over the source's own frontmatter, as one more directive, before parsing —
* e.g. `{ layered: { edgeRouting: 'stepped' } }`. It is also merged onto `layout.config`
* directly, so keys the config schema does not know yet (directives drop those) still arrive.
*/
config?: Record<string, unknown>;
}
/**
* Parse Mermaid source through the real diagram pipeline (preprocess → Diagram.fromText →
* getData), as the unified renderers do. Callers set `layoutAlgorithm` as needed.
*/
export declare function parseMmdTextToLayoutData(mmdText: string, options?: ParseToLayoutDataOptions): Promise<LayoutData>;
/** {@link parseMmdTextToLayoutData} for a `.mmd` file. */
export declare function parseMmdFileToLayoutData(mmdPath: string, options?: ParseToLayoutDataOptions): Promise<LayoutData>;