{"_id":"@brrock/excalidraw-mermaid","_rev":"6-bdcb929a6a3410de8707f1484bdcbd01","name":"@brrock/excalidraw-mermaid","dist-tags":{"latest":"1.3.2"},"versions":{"1.1.4":{"name":"@brrock/excalidraw-mermaid","version":"1.1.4","keywords":["excalidraw","mermaid","diagram","parser"],"author":{"name":"Excalidraw"},"license":"MIT","_id":"@brrock/excalidraw-mermaid@1.1.4","maintainers":[{"name":"brrock","email":"brduck@duck.com"}],"homepage":"https://github.com/excalidraw/mermaid-to-excalidraw#readme","bugs":{"url":"https://github.com/excalidraw/mermaid-to-excalidraw/issues"},"dist":{"shasum":"14afde8e31560b34828b04ae986ea53c821758b5","tarball":"https://registry.npmjs.org/@brrock/excalidraw-mermaid/-/excalidraw-mermaid-1.1.4.tgz","fileCount":5,"integrity":"sha512-xUxZyKe1fuUQ3/ZnQmU3WOUu3crfBxWlvC2Un4rwNSgQsOcgLzv5I8UnX9/EoYdOf3iqONkPCT3HSqyJTIXe+A==","signatures":[{"sig":"MEUCIDkxZnX+L4zf4cz6Az5xt5SwqZ3pjKfoGVxbjaRUs6GjAiEA+x9s8C6wbFjUj4or0oNzElb39Sm+rjQEsXt0/Th/c/s=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30514},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"6c89fa74651f23337ad6f4efe54cd7581b13a188","scripts":{"lint":"eslint src","test":"vitest run","build":"tsdown","format":"prettier --write src","test:watch":"vitest","prepublishOnly":"bun run build"},"_npmUser":{"name":"brrock","email":"brduck@duck.com"},"repository":{"url":"git+https://github.com/excalidraw/mermaid-to-excalidraw.git","type":"git"},"_npmVersion":"11.6.2","description":"A parser to convert Mermaid diagrams to Excalidraw format","directories":{},"_nodeVersion":"25.2.1","dependencies":{"nanoid":"^5.1.6"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.42.0","tsdown":"^0.20.3","vitest":"^3.0.0","prettier":"^2.8.8","typescript":"^5.9.3","eslint-config-prettier":"^8.8.0","eslint-plugin-prettier":"^4.2.1","@excalidraw/eslint-config":"^1.0.3","@typescript-eslint/parser":"^8.56.0","@typescript-eslint/eslint-plugin":"^8.56.0"},"peerDependencies":{"mermaid":"^10.9.0 || ^11.0.0"},"_npmOperationalInternal":{"tmp":"tmp/excalidraw-mermaid_1.1.4_1771669728747_0.8165850818868308","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@brrock/excalidraw-mermaid","version":"1.2.0","keywords":["excalidraw","mermaid","diagram","parser"],"author":{"name":"Excalidraw"},"license":"MIT","_id":"@brrock/excalidraw-mermaid@1.2.0","maintainers":[{"name":"brrock","email":"brduck@duck.com"}],"homepage":"https://github.com/excalidraw/mermaid-to-excalidraw#readme","bugs":{"url":"https://github.com/excalidraw/mermaid-to-excalidraw/issues"},"dist":{"shasum":"2a68a8856fbddeae3d70a221b96678480247c791","tarball":"https://registry.npmjs.org/@brrock/excalidraw-mermaid/-/excalidraw-mermaid-1.2.0.tgz","fileCount":5,"integrity":"sha512-J83i4B169yyuyD98o5djP2aW5Iz2Kk6L8PN8/LNdxQoHFGP9oKAqktrSgd1M8ALY9q1fhXAk6ZVFSWYTOnKgJQ==","signatures":[{"sig":"MEUCIQCujHm6z6TvBwrrS0YgPAkNpqe2G5nLAzqIvUHJrsWe2QIgKhjJBDKvO+9/husKq/IwhegkVw3nDSEsTmSF7oWQoJA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36383},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"6c89fa74651f23337ad6f4efe54cd7581b13a188","scripts":{"lint":"eslint src","test":"vitest run","build":"tsdown","format":"prettier --write src","test:watch":"vitest","prepublishOnly":"bun run build"},"_npmUser":{"name":"brrock","email":"brduck@duck.com"},"repository":{"url":"git+https://github.com/excalidraw/mermaid-to-excalidraw.git","type":"git"},"_npmVersion":"11.6.2","description":"A parser to convert Mermaid diagrams to Excalidraw format","directories":{},"_nodeVersion":"25.2.1","_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.42.0","tsdown":"^0.20.3","vitest":"^3.0.0","prettier":"^2.8.8","@types/bun":"latest","typescript":"^5.9.3","eslint-config-prettier":"^8.8.0","eslint-plugin-prettier":"^4.2.1","@excalidraw/eslint-config":"^1.0.3","@typescript-eslint/parser":"^8.56.0","@typescript-eslint/eslint-plugin":"^8.56.0"},"peerDependencies":{"mermaid":"^10.9.0 || ^11.0.0"},"_npmOperationalInternal":{"tmp":"tmp/excalidraw-mermaid_1.2.0_1771675347385_0.5807038823083235","host":"s3://npm-registry-packages-npm-production"}},"1.2.1":{"name":"@brrock/excalidraw-mermaid","version":"1.2.1","keywords":["excalidraw","mermaid","diagram","parser"],"author":{"name":"Excalidraw"},"license":"MIT","_id":"@brrock/excalidraw-mermaid@1.2.1","maintainers":[{"name":"brrock","email":"brduck@duck.com"}],"homepage":"https://github.com/brrock/mermaid-to-excalidraw#readme","bugs":{"url":"https://github.com/brrock/mermaid-to-excalidraw/issues"},"dist":{"shasum":"41317c9b7bd24b542103c60a9d997e51007ff172","tarball":"https://registry.npmjs.org/@brrock/excalidraw-mermaid/-/excalidraw-mermaid-1.2.1.tgz","fileCount":5,"integrity":"sha512-jlZeJblTXL5KATWj8h6HFkrt3plQzYZx7IdV4iHL8O5ANMu8qYo229QM1f31iK8uJzZvISd006ZXpXpLP51WhA==","signatures":[{"sig":"MEYCIQDP6V/uVzQc7unYeSlG/TW1P5cxMgSUmBgxyy+r2hpahwIhAPHfrZVDomhTwVNGdEPT4pWVCrsdVn52DElMVMIwMf0e","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36379},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"396f7094a6d890788c5609793cbed870b0a923f3","scripts":{"lint":"eslint src","test":"vitest run","build":"tsdown","format":"prettier --write src","test:watch":"vitest","prepublishOnly":"bun run build"},"_npmUser":{"name":"brrock","email":"brduck@duck.com"},"repository":{"url":"git+https://github.com/brrock/mermaid-to-excalidraw.git","type":"git"},"_npmVersion":"11.6.2","description":"A parser to convert Mermaid diagrams to Excalidraw format","directories":{},"_nodeVersion":"25.2.1","_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.42.0","tsdown":"^0.20.3","vitest":"^3.0.0","prettier":"^2.8.8","@types/bun":"latest","typescript":"^5.9.3","eslint-config-prettier":"^8.8.0","eslint-plugin-prettier":"^4.2.1","@excalidraw/eslint-config":"^1.0.3","@typescript-eslint/parser":"^8.56.0","@typescript-eslint/eslint-plugin":"^8.56.0"},"peerDependencies":{"mermaid":"^10.9.0 || ^11.0.0"},"_npmOperationalInternal":{"tmp":"tmp/excalidraw-mermaid_1.2.1_1771694743152_0.6478781714707988","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@brrock/excalidraw-mermaid","version":"1.3.0","keywords":["excalidraw","mermaid","diagram","parser"],"author":{"name":"Excalidraw"},"license":"MIT","_id":"@brrock/excalidraw-mermaid@1.3.0","maintainers":[{"name":"brrock","email":"brduck@duck.com"}],"homepage":"https://github.com/brrock/mermaid-to-excalidraw#readme","bugs":{"url":"https://github.com/brrock/mermaid-to-excalidraw/issues"},"dist":{"shasum":"bc86c5b4a2b08e844888031f5f3f517fa89e65cd","tarball":"https://registry.npmjs.org/@brrock/excalidraw-mermaid/-/excalidraw-mermaid-1.3.0.tgz","fileCount":5,"integrity":"sha512-7ia/McZvufInlWs5vp7Aj52t6WTEFXABwX6wBhSlsL8xmPyaGE3clzdQDAofECrlsM+kNutysInusaonqu8AvQ==","signatures":[{"sig":"MEQCIBZp3u3Eg8TK38i7p1oABJ2dQIfzNjxIAqCQALsHDRVUAiBzVmoUikDOYy5TLIvQzonrfSAK9gOeEtmR05avkFhLDw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36380},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"396f7094a6d890788c5609793cbed870b0a923f3","scripts":{"lint":"eslint src","test":"vitest run","build":"tsdown","format":"prettier --write src","test:watch":"vitest","prepublishOnly":"bun run build"},"_npmUser":{"name":"brrock","email":"brduck@duck.com"},"repository":{"url":"git+https://github.com/brrock/mermaid-to-excalidraw.git","type":"git"},"_npmVersion":"11.6.2","description":"A parser to convert Mermaid diagrams to Excalidraw format","directories":{},"_nodeVersion":"25.2.1","_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.42.0","tsdown":"^0.20.3","vitest":"^3.0.0","prettier":"^2.8.8","@types/bun":"latest","typescript":"^5.9.3","eslint-config-prettier":"^8.8.0","eslint-plugin-prettier":"^4.2.1","@excalidraw/eslint-config":"^1.0.3","@typescript-eslint/parser":"^8.56.0","@typescript-eslint/eslint-plugin":"^8.56.0"},"peerDependencies":{"mermaid":"latest"},"_npmOperationalInternal":{"tmp":"tmp/excalidraw-mermaid_1.3.0_1771702085851_0.376153082534717","host":"s3://npm-registry-packages-npm-production"}},"1.3.1":{"name":"@brrock/excalidraw-mermaid","version":"1.3.1","keywords":["excalidraw","mermaid","diagram","parser"],"author":{"name":"Excalidraw"},"license":"MIT","_id":"@brrock/excalidraw-mermaid@1.3.1","maintainers":[{"name":"brrock","email":"brduck@duck.com"}],"homepage":"https://github.com/brrock/mermaid-to-excalidraw#readme","bugs":{"url":"https://github.com/brrock/mermaid-to-excalidraw/issues"},"dist":{"shasum":"7abef2d6567c72d3656d0728fdb00c13ae4c447c","tarball":"https://registry.npmjs.org/@brrock/excalidraw-mermaid/-/excalidraw-mermaid-1.3.1.tgz","fileCount":5,"integrity":"sha512-Y9Xd7a7yLSLzP5Rrz7BPzO/Vvj1EL8rwrTM/4ARTrbE1/cJAt5DCwLT3ETv4/55TcOdyJEneNCkOqIMhlkuing==","signatures":[{"sig":"MEUCIQD1qGk+hvtBgcjOM2fkV+YPDoYwo2Mc+YCCUQPti25DVQIgMr8IrwDI2ylkPFhWdgncPpdHviCYmx2LN2RZoAX5Gu0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36374},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"396f7094a6d890788c5609793cbed870b0a923f3","scripts":{"lint":"eslint src","test":"vitest run","build":"tsdown","format":"prettier --write src","test:watch":"vitest","prepublishOnly":"bun run build"},"_npmUser":{"name":"brrock","email":"brduck@duck.com"},"repository":{"url":"git+https://github.com/brrock/mermaid-to-excalidraw.git","type":"git"},"_npmVersion":"11.6.2","description":"A parser to convert Mermaid diagrams to Excalidraw format","directories":{},"_nodeVersion":"25.2.1","_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.42.0","tsdown":"^0.20.3","vitest":"^3.0.0","prettier":"^2.8.8","@types/bun":"latest","typescript":"^5.9.3","eslint-config-prettier":"^8.8.0","eslint-plugin-prettier":"^4.2.1","@excalidraw/eslint-config":"^1.0.3","@typescript-eslint/parser":"^8.56.0","@typescript-eslint/eslint-plugin":"^8.56.0"},"peerDependencies":{"mermaid":"latest"},"_npmOperationalInternal":{"tmp":"tmp/excalidraw-mermaid_1.3.1_1771703268101_0.5247993098576749","host":"s3://npm-registry-packages-npm-production"}},"1.3.2":{"name":"@brrock/excalidraw-mermaid","version":"1.3.2","description":"A parser to convert Mermaid diagrams to Excalidraw format","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsdown","test":"vitest run","test:watch":"vitest","lint":"eslint src","format":"prettier --write src","prepublishOnly":"bun run build"},"keywords":["excalidraw","mermaid","diagram","parser"],"author":{"name":"Excalidraw"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/brrock/mermaid-to-excalidraw.git"},"peerDependencies":{"mermaid":"latest"},"devDependencies":{"@excalidraw/eslint-config":"^1.0.3","@typescript-eslint/eslint-plugin":"^8.56.0","@typescript-eslint/parser":"^8.56.0","eslint":"^8.42.0","eslint-config-prettier":"^8.8.0","eslint-plugin-prettier":"^4.2.1","prettier":"^2.8.8","tsdown":"^0.20.3","typescript":"^5.9.3","vitest":"^3.0.0","@types/bun":"latest"},"gitHead":"396f7094a6d890788c5609793cbed870b0a923f3","_id":"@brrock/excalidraw-mermaid@1.3.2","bugs":{"url":"https://github.com/brrock/mermaid-to-excalidraw/issues"},"homepage":"https://github.com/brrock/mermaid-to-excalidraw#readme","_nodeVersion":"25.2.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-sBkZXo4bhgCfu9eGt2z+u7nr0rdU8M4wN9DCDDIB7v0/4y/qdog4JXzZi8+9PYHux02DfnBPBcRKnTzt1LEkMw==","shasum":"1a828462d4f85e7a8996759764bd7c5158bf6d1b","tarball":"https://registry.npmjs.org/@brrock/excalidraw-mermaid/-/excalidraw-mermaid-1.3.2.tgz","fileCount":5,"unpackedSize":35807,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIB++voRzoCK+sYrbo8X7oETxkLa01kEqauIOfYtOMzerAiBfVIFIu4AridOcBsacx5NB+zcO7w0fYkTkSx9NIlMTBg=="}]},"_npmUser":{"name":"brrock","email":"brduck@duck.com"},"directories":{},"maintainers":[{"name":"brrock","email":"brduck@duck.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/excalidraw-mermaid_1.3.2_1771703984887_0.1816323472413266"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-21T10:28:48.663Z","modified":"2026-02-21T19:59:45.164Z","1.1.4":"2026-02-21T10:28:48.880Z","1.2.0":"2026-02-21T12:02:27.539Z","1.2.1":"2026-02-21T17:25:43.293Z","1.3.0":"2026-02-21T19:28:05.994Z","1.3.1":"2026-02-21T19:47:48.249Z","1.3.2":"2026-02-21T19:59:45.048Z"},"bugs":{"url":"https://github.com/brrock/mermaid-to-excalidraw/issues"},"author":{"name":"Excalidraw"},"license":"MIT","homepage":"https://github.com/brrock/mermaid-to-excalidraw#readme","keywords":["excalidraw","mermaid","diagram","parser"],"repository":{"type":"git","url":"git+https://github.com/brrock/mermaid-to-excalidraw.git"},"description":"A parser to convert Mermaid diagrams to Excalidraw format","maintainers":[{"name":"brrock","email":"brduck@duck.com"}],"readme":"# @brrock/excalidraw-mermaid\n\nConvert Mermaid diagrams to Excalidraw elements.\n\n## Installation\n\n```bash\nbun add @brrock/excalidraw-mermaid\n# or\nnpm install @brrock/excalidraw-mermaid\n```\n\n**Note:** `mermaid` is a peer dependency and must be installed separately.\n\n```bash\nbun add mermaid\n# or\nnpm install mermaid\n```\n\n## Usage\n\n### Simple Example\n\n```ts\nimport {\n  parseMermaidToExcalidraw,\n  serializeToExcalidraw,\n} from \"@brrock/excalidraw-mermaid\";\n\nconst diagramDefinition = `\n  graph TD\n    A[Start] --> B[End]\n`;\n\ntry {\n  // 1. Convert Mermaid to Excalidraw results (elements and binary files)\n  const result = await parseMermaidToExcalidraw(diagramDefinition);\n\n  // 2. (Optional) Serialize to the full .excalidraw file format\n  const fullScene = serializeToExcalidraw(result);\n\n  console.log(fullScene);\n} catch (e) {\n  // Handle parse/validation errors\n}\n```\n\n## API\n\n### `parseMermaidToExcalidraw(definition, config?)`\n\nConverts a Mermaid diagram definition to Excalidraw results.\n\n**Parameters:**\n\n- `definition` (string): The Mermaid diagram definition.\n- `config` (MermaidConfig, optional): Configuration for the Mermaid parser.\n\n**Returns:**\n\n- `Promise<MermaidToExcalidrawResult>`: An object containing `elements` and `files`.\n\n```ts\ninterface MermaidToExcalidrawResult {\n  elements: ExcalidrawElementSkeleton[];\n  files?: BinaryFiles;\n}\n```\n\n### `serializeToExcalidraw(result)`\n\nWraps the conversion result into a full Excalidraw file structure. This function automatically expands intermediate skeletons into final Excalidraw elements (e.g., separating text labels from shapes and linking them via `containerId`), making the result ready to be saved as an `.excalidraw` file or imported directly.\n\n**Parameters:**\n\n- `result` (MermaidToExcalidrawResult): The output from `parseMermaidToExcalidraw`.\n\n**Returns:**\n\n- `ExcalidrawScene`: A complete Excalidraw scene object.\n\n```ts\ninterface ExcalidrawScene {\n  type: \"excalidraw\";\n  version: 2;\n  source: string;\n  elements: ExcalidrawElement[]; // Final expanded elements\n  appState: {\n    gridSize: number;\n    viewBackgroundColor: string;\n    // ... other app state defaults\n  };\n  files: BinaryFiles;\n}\n```\n\n### `validateMermaid(mermaidStr)`\n\nHelper to validate Mermaid syntax before attempting conversion.\n\n**Parameters:**\n\n- `mermaidStr` (string): The Mermaid diagram definition.\n\n**Returns:**\n\n- `Promise<boolean>`: True if valid, throws or returns false otherwise (depending on mermaid version).\n\n## Configuration\n\n### `MermaidConfig`\n\n```ts\ninterface MermaidConfig {\n  startOnLoad?: boolean;\n  flowchart?: {\n    curve?: \"linear\" | \"basis\";\n  };\n  themeVariables?: {\n    fontSize?: string;\n  };\n  maxEdges?: number;\n  maxTextSize?: number;\n}\n```\n\n### Supported Diagram Types\n\n- Flowchart\n- Sequence\n- Class\n\n## Building\n\n```bash\nbun install\nbun run build\n```\n","readmeFilename":"README.md"}