feature/2645: add TreeView Diagram #7396
Conversation
…add_tree_view_diagram_update # Conflicts: # .build/jsonSchema.ts # demos/index.html # docs/config/setup/interfaces/mermaid.MermaidConfig.md # docs/config/setup/modules/defaultConfig.md # packages/mermaid/src/config.type.ts # packages/mermaid/src/defaultConfig.ts # packages/mermaid/src/diagram-api/diagram-orchestration.ts # packages/mermaid/src/docs/.vitepress/config.ts # packages/mermaid/src/mermaidAPI.spec.ts # packages/mermaid/src/schemas/config.schema.yaml # packages/mermaid/src/styles.spec.ts # packages/parser/langium-config.json # packages/parser/src/language/index.ts # packages/parser/src/parse.ts
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: cba0761 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
@mermaid-js/examples
mermaid
@mermaid-js/layout-elk
@mermaid-js/layout-tidy-tree
@mermaid-js/mermaid-zenuml
@mermaid-js/parser
@mermaid-js/tiny
commit: |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
|
There is a unit test failure relating to accessibility that I am investigating We would expect those accessibility keywords to result in nodes added to the svg as per this example:
This is a issue with the grammar, easier to understand the behaviour from the langium playground. You can observe that all the words in the title, accessible title and description become nodes for the tree diagram. Update: fixed, but I found the whitespace / indent handling to be very fragile. Seems we observed this with treemap already and updating to langium v4 |
…add_tree_view_diagram_update # Conflicts: # packages/mermaid/src/docs/.vitepress/config.ts
|
@knsv all blocking feedback and fresh merge conflicts addressed, I'm hoping this one is good to go after a few contributors trying to finish it off the last couple of years 🤞 |
knsv
left a comment
There was a problem hiding this comment.
Great Work!
All three blocking issues are resolved:
- ✅ Parser test file now included — packages/parser/tests/treeView.test.ts is in the PR with 7 test cases, including the new multi-word test ("Multi Word Root"). Well done.
- ✅ Changeset is now minor — .changeset/weak-tools-pay.md correctly bumps all three packages as minor.
- ✅ Multi-word node names — The grammar was redesigned to use quoted strings (STRING2: /"[^"]"|'[^']'/), with the valueConverter stripping quotes. This is a clean solution. The demo no longer has broken node
names.
Also fixed:
- ✅ Cypress tests now have 4 cases including a custom config test that exercises labelColor, lineColor, and rowIndent. Nice addition. 🎉
|
The PR was removed from the merge queue due to a unit test failure. The cause is a new unit test that was merged earlier today via #7410. I've pushed a commit to make the new test aware of this new diagram and the unit tests are now passing, ready for another stab at the merge queue if possible @knsv 🙏 |
b681756
…tions, highlights Extends treeView-beta (PR mermaid-js#7396 by @lee-treehouse and @Vikrantpalle) with file-tree-specific features: - Bare (unquoted) labels: src/, index.js, .gitignore - 30+ auto-detected file-type icons (JS, TS, Python, Docker, etc.) - :::class annotations (e.g. :::highlight for yellow background) - icon(name) overrides for custom icons - ## inline descriptions, column-aligned across all nodes - Directory auto-detection via trailing slash - Folder names with spaces (unquoted) - Two-pass rendering for description column alignment - Diagram-scoped icon symbol IDs (no duplicates on multi-diagram pages) - Side-by-side demo page showing input syntax next to rendered output - 26 new parseNodeContent unit tests + 8 new Langium parser tests - 5 new Cypress E2E tests - Comprehensive docs rewrite with all new features Grammar: NODE_CONTENT terminal captures rest-of-line; detailed annotation parsing (:::class, icon(), ##) delegated to TypeScript parseNodeContent(). Closes mermaid-js#7516
|
Its probably too late, but one of the most use cases for a tree file view in ascii is to add comments or descriptions behind the file - folder. AI uses that extensively like below. Was searching if mermaid could do that natively and landed here. |
|
@D1no Thanks for the suggestion! |
|
👍 will do |




📑 Summary
This 2024 PR #5665 introduced TreeView diagram and went through a thorough review process including updates to use Langium parser, docs, tests etc. The new diagram addressed issue #2645
That PR was almost merge ready. This PR branches off the original PR and addresses the following:
I am happy to address any other changes required (or reinvolve @Vikrantpalle)
📋 Tasks
Make sure you
MERMAID_RELEASE_VERSIONis used for all new features.pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.