Skip to content
المشاريع

excalidraw/mermaid-to-excalidraw

عرض على GitHub

حول

إنشاء مخططات Excalidraw من Mermaid.

التصميم والوسائط

كيف تُقاس هذه الأرقام

923 نجمة141 التفرعات +1 خلال 24 ساعة

ما يمكنك فعله

  • ✏️ 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.

النمو المقاس للنجوم

خلال 24 ساعة
+١
خلال 7 أيام
+١
خلال 15 يومًا
+٣
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

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

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…