Mermaid

Development

Run the playground, the tests and a build of @excalidraw/mermaid-to-excalidraw.

Setup

git clone git@github.com:excalidraw/mermaid-to-excalidraw.git
cd mermaid-to-excalidraw
yarn

Playground

yarn start

Starts the playground at localhost:3418. It converts the definition you type and every test case, and shows Pele's drawing next to the Excalidraw result. It's deployed to mermaid-to-excalidraw.vercel.app.

Tests

CommandWhat it does
yarn testUnit tests (Vitest, in tests/)
yarn test:codeESLint
yarn test:visualVisual tests (Playwright): a snapshot of each feature test case
yarn test:visual:updateRecords new visual snapshots after an intended change
yarn test:visual:devThe visual test page at localhost:3419, usually handier than the playground for comparing a case

Test cases

Test cases are Mermaid files in testcases/, named <type>-<name>.mmd, where the type is flowchart, sequence, class, erd, state, swimlane or unsupported:

  • testcases/features/ has one syntax feature per file. The playground lists them, the visual tests snapshot each one (named after the file), and the unit tests parse them. Add a case as a new file: renaming one renames its snapshot.
  • testcases/examples/ has whole diagrams that models wrote for the prompts in prompts.md, with the model and prompt in %% comments at the top. They're for checking the layout and performance of real-world diagrams.

Build

yarn build

Compiles the library to dist/.

Branches

master is v3. v2 is maintained on release/2.x. Changes are listed in CHANGELOG.md.

Last updated on

On this page