Skip to content

feat:ditaa_v1_CI_fixes#7747

Open
Swayam-hue wants to merge 6 commits into
mermaid-js:developfrom
Swayam-hue:feature/7725_add-ditaa-diagram-support
Open

feat:ditaa_v1_CI_fixes#7747
Swayam-hue wants to merge 6 commits into
mermaid-js:developfrom
Swayam-hue:feature/7725_add-ditaa-diagram-support

Conversation

@Swayam-hue
Copy link
Copy Markdown

📑 Summary

Adds initial ditaa diagram support to Mermaid using a custom TypeScript-based ASCII grid parser and SVG renderer. The implementation introduces lazy-loaded diagram registration, theme-aware rendering, unit tests, E2E snapshot tests, demo pages, and user documentation.

Current MVP supports:

  • rectangular and rounded boxes
  • horizontal/vertical connectors
  • directional and bidirectional arrows
  • dashed borders/connectors
  • free-floating text labels
  • Mermaid theme integration (default, dark, forest, neutral)

Resolves #7725

📏 Design Decisions

  • Implemented a custom ASCII-grid parser instead of Langium since DITAA is spatial rather than grammar-based.
  • Added a dedicated ditaa diagram module following Mermaid's standard architecture:
    • detector
    • parser
    • db
    • renderer
    • styles
  • Used a 3-phase parsing pipeline:
    1. box detection
    2. arrow detection
    3. free-floating text extraction
  • Implemented a pure TypeScript/D3 SVG renderer with no external rendering dependencies or WASM.
  • Integrated Mermaid theme variables for consistent styling.
  • Added 17 Vitest unit tests and 12 Cypress E2E snapshot tests - all passed.

📏 Limitations

  1. Monospace grid only: Tabs and variable-width fonts break detection
  2. No color or shadow tags yet: Can be worked upon as soon as the initial build is accepted
  3. No diagonal lines: Only horizontal (-) and vertical (|) are implemented
  4. No line bending: Single direction lines only

📏 Demo

Input

ditaa
+-----------+      /-------------\      +-------------+
|           | ---> |             | ---> |             |
|  Mobile   |      | Notification|      | SMS Gateway |
|   App     | <--- |   Service   | <--- |             |
+-----------+      |             |      +-------------+
                   \-------------/
                           |
                           |
                           v
                    +-------------+
                    |             |
                    | Email Queue |
                    |             |
                    +-------------+

Output
image

📋 Tasks

  • 📖 have read the contribution guidelines
  • 💻 have added necessary unit/e2e tests.
  • 📓 have added documentation. Make sure MERMAID_RELEASE_VERSION is used for all new features.
  • 🦋 If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 13, 2026

Deploy Preview for mermaid-js failed.

Name Link
🔨 Latest commit 59f9728
🔍 Latest deploy log https://app.netlify.com/projects/mermaid-js/deploys/6a0434e5e5710a000863280f

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 13, 2026

🦋 Changeset detected

Latest commit: 59f9728

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mermaid Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the Type: Enhancement New feature or request label May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add DITAA to the available diagram types

1 participant