Skip to content
Proyectos

excalidraw/mermaid-to-excalidraw

Ver en GitHub

Acerca de

Genera diagramas de Excalidraw a partir de Mermaid

Diseño y multimedia

Cómo se miden estas cifras

What you can do

  • ✏️ Editable result: nodes become shapes, edges become arrows bound to them, labels stay where the layout put them.
  • 📊 Many diagram types: flowcharts (including swimlane-beta), sequence, class, ER and state diagrams, Gantt charts, quadrant charts and timelines. Other types are inserted as an image.
  • 🎨 Styles carry over: style, classDef and class colors, click links, and edges as elbow arrows on request.
  • ⚡ No Mermaid runtime: Pele parses and lays diagrams out without rendering them into the page, and each diagram type's code loads on first use.

Crecimiento de estrellas medido

in 24h
+1
in 7 days
+1
in 15 days
+3
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

Mermaid to Excalidraw: turn Mermaid diagrams into shapes, arrows and text you can keep editing

Documentation · Playground · npm · Excalidraw+ · Excalidraw

npm license

Convert Mermaid diagram definitions into Excalidraw elements: shapes, arrows and text you can keep editing, not a picture of the diagram. It's what excalidraw.com runs when you paste a Mermaid definition onto the canvas.

Features

  • ✏️ Editable result: nodes become shapes, edges become arrows bound to them, labels stay where the layout put them.
  • 📊 Many diagram types: flowcharts (including swimlane-beta), sequence, class, ER and state diagrams, Gantt charts, quadrant charts and timelines. Other types are inserted as an image.
  • 🎨 Styles carry over: style, classDef and class colors, click links, and edges as elbow arrows on request.
  • ⚡ No Mermaid runtime: Pele parses and lays diagrams out without rendering them into the page, and each diagram type's code loads on first use.

Install

npm install @excalidraw/mermaid-to-excalidraw @excalidraw/excalidraw

It needs DOM APIs (DOMParser), so run it in a browser or with jsdom.

Quick start

import { parseMermaidToExcalidraw } from "@excalidraw/mermaid-to-excalidraw";
import { convertToExcalidrawElements } from "@excalidraw/excalidraw";

const definition = `flowchart LR
  A[Write the definition] --> B{Valid?}
  B -->|yes| C[Excalidraw elements]
  B -->|no| D[Parse error]`;

try {
  const { elements, files } = await parseMermaidToExcalidraw(definition, {
    elbow: true, // optional: draw edges as elbow arrows
  });

  excalidrawAPI.updateScene({
    elements: convertToExcalidrawElements(elements),
  });
  if (files) {
    excalidrawAPI.addFiles(Object.values(files));
  }
} catch (error) {
  // Not valid Mermaid syntax: show the error to the user
}

No code needed? The Excalidraw CLI runs it from your terminal: npx @excalidraw/cli mermaid flow.mmd --out flow.excalidraw.

Documentation

📚 plus.excalidraw.com/docs/mermaid-to-excalidraw

What changed in each release is in the changelog.

Contributing

See CONTRIBUTING.md for running the playground and the tests.

License

MIT

Explorar proyectos relacionados

Cargando…