Frontmatter
| id | 8757 |
| title | Fix Mermaid Diagram Text Truncation and Sizing |
| state | Closed |
| labels | bugdesignai |
| assignees | tobiu |
| createdAt | Jan 17, 2026, 12:03 PM |
| updatedAt | Jan 17, 2026, 1:23 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8757 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 17, 2026, 1:23 PM |
Fix Mermaid Diagram Text Truncation and Sizing

tobiu
Jan 17, 2026, 1:22 PM
Input from Gemini 3 Pro:
✦ I have resolved the Mermaid text truncation issue.
Diagnosis: The previous attempt using
mermaid.render()generated SVGs in a detached context, leading to incorrect font measurements and clipped text. The SVGmax-widthwas also a symptom, not the root cause.Solution:
- Revert to
mermaid.run(): This method renders the diagram directly in the DOM, allowing Mermaid to measure the actual rendered fonts and container dimensions.- Force Re-processing: The critical fix was explicitly removing the
data-processedattribute (element.removeAttribute('data-processed')) before callingrun(). This tricks Mermaid into treating the existing element as a new diagram, enabling updates without destroying the container.- SCSS: The
resources/scss/src/component/wrapper/Mermaid.scssfile is kept but empty for now, preserving the file structure for future styling if needed.This approach ensures correct layout calculation and supports dynamic updates.
tobiu closed this issue on Jan 17, 2026, 1:23 PM
tobiu assigned to @tobiu on Jan 17, 2026, 1:23 PM
I've identified a rendering issue where Mermaid diagram text can be cut off even when the parent container has sufficient space.
Symptoms:
Potential Causes:
width: 100%,height: auto).Proposed Fix:
.neo-mermaid svg.Neo.component.wrapper.Mermaid(via SCSS or style config) to ensure the SVG fills its container:.neo-mermaid svg { width: 100%; height: auto; max-width: 100%; }mermaid.renderconfig needsuseMaxWidth: falseor similar adjustments.Scope:
resources/scssfiles.src/component/wrapper/Mermaid.mjs.