Package Exports
- @excalidraw/mermaid-to-excalidraw
- @excalidraw/mermaid-to-excalidraw/dist/index.js
- @excalidraw/mermaid-to-excalidraw/dist/interfaces
- @excalidraw/mermaid-to-excalidraw/dist/interfaces.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@excalidraw/mermaid-to-excalidraw) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
mermaid-to-excalidraw
Convert mermaid diagrams to excalidraw
Set up
Install packages:
yarnStart development playground:
yarn startBuild command:
yarn buildGet started
parseMermaidToExcalidraw(diagramDefinition: string, config?: MermaidConfig)The diagramDefinition is the mermaid diagram definition.
and config is the mermaid config. You can use the config param when you want to pass some custom config to mermaid.
Currently mermaid-to-excalidraw only supports the 👇 config params
{
/**
* Whether to start the diagram automatically when the page loads.
* @default false
*/
startOnLoad?: boolean;
/**
* The flowchart curve style.
* @default "linear"
*/
flowchart?: {
curve?: "linear" | "basis";
};
/**
* Theme variables
* @default { fontSize: "20px" }
*/
themeVariables?: {
fontSize?: string;
};
/**
* Maximum number of edges to be rendered.
* @default 500
*/
maxEdges?: number;
/**
* Maximum number of characters to be rendered.
* @default 50000
*/
maxTextSize?: number;
}Example code:
import { parseMermaidToExcalidraw } from "@excalidraw/mermaid-to-excalidraw";
try {
const { elements, files } = await parseMermaidToExcalidraw(
diagramDefinition,
{
themeVariables: {
fontSize: "25px",
},
}
);
// Render elements and files on Excalidraw
} catch (e) {
// Parse error, displaying error message to users
}Playground
Try out here.
API
Head over to the docs.
Support new Diagram type
Head over to the docs.