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
- Repository root
- Repository root
- Likely public API
- Likely public API
- Suggested starting pointAI
- Suggested starting pointAI
- Suggested starting pointAI
- Suggested starting pointAI
Find files for a task
AIAdd 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.