RepoPilot

mermaid-js / mermaid

Search mermaid-js/mermaid

GitHub

Code

How mermaid-js/mermaid is laid out, and where to start for common changes.

There is no import map for this report yet.

Where to start reading

  1. Repository root
  2. Repository root
  3. Likely public API
  4. Likely public API
  5. Suggested starting pointAI
  6. Suggested starting pointAI
  7. Suggested starting pointAI
  8. Suggested starting pointAI

Find files for a task

AI

Add a new diagram type

  • Create diagram folder in packages/mermaid/src/diagrams/{diagramType}/ with detector, parser, and data model.
  • Register the diagram type in packages/mermaid/src/diagram-api/diagram-orchestration.ts by adding it to the diagram registry.
  • Implement diagram rendering logic in {diagramType}/diagram.ts extending the core Diagram class.
  • Add theme variables for the diagram type in packages/mermaid/src/themes/theme-{diagramType}-vars.spec.ts.

Add a new configuration option

  • Define the configuration schema in packages/mermaid/src/schemas/config.schema.yaml.
  • Add the default value to packages/mermaid/src/defaultConfig.ts.
  • Update the type definitions in packages/mermaid/src/config.type.ts.
  • Apply the configuration in packages/mermaid/src/config.ts using the mergeConfig logic.

Add a new theme

  • Create theme file in packages/mermaid/src/themes/theme-{themeName}.js with color and styling variables.
  • Register the theme in packages/mermaid/src/themes/index.js in the theme registry.
  • Add type-specific theme overrides in packages/mermaid/src/themes/theme-{themeName}-overrides.spec.js if needed.

Add rendering for a new text/markdown feature

  • Update markdown handling logic in packages/mermaid/src/rendering-util/handle-markdown-text.ts.
  • Modify SVG text element creation in packages/mermaid/src/rendering-util/createText.ts.
  • Add corresponding tests in packages/mermaid/src/rendering-util/{feature}.spec.ts.

Change the public API

Add or update tests

Change build or automation

RepoPilot lists up to 500 files, so a file missing here may still exist.

  • Files marked “likely” are guessed from their names.

Code quality and hotspots

Largest source files

  • Branch points223 per file on average
  • Code issues0 errors, 44 warnings
  • Largest file3,036 lines
  • Hotspot load8 high-risk files

Static checks on the 15 largest source files.

Tests, CI and tooling

  • CIGitHub Actions24 workflows
  • Tests3,044 test filesJest/Vitest · 4.3 test files per source file (file count, not coverage)
  • Dependency updatesCodeQL

Test folders: e2e/diagrams/agentflow/visual-check · e2e/diagrams/agentflow/pr-check · e2e/diagrams/agentflow/nightly-check

Hotspots

Files that change often and branch heavily, highest first. Branch points count if, loop, case, catch, ternary, && and || in the file.