Repository navigation
fix(mermaid): prevent clipped multiline labels - #369
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 9466fa6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #369 +/- ##
=======================================
Coverage 66.94% 66.94%
=======================================
Files 100 100
Lines 3903 3903
Branches 1152 1152
=======================================
Hits 2613 2613
Misses 1026 1026
Partials 264 264 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Mermaid measures labels under
document.bodywhen no rendering container is supplied. Doom then inserts the SVG into the Rspress documentation page, whose paragraph styles change the labels' line height. TheforeignObjectdimensions stay unchanged, clipping text such as an example IP address,switch, andauth-response.set-cookie.For example, a three-line label is measured at 72px with Mermaid 11 or 63px with Mermaid 12, but becomes 84px tall inside the documentation page.
What changed
Pass the display container to
mermaid.renderso label measurement and display use the same page styles. Add a patch changeset.Browser verification covers all eight Mermaid diagrams from acp-docs
release-4.4(a1ef0023), in light and dark themes, with both Mermaid 11.15.0 and #368's Mermaid 12.2.0 (1a35cc7applied locally).The check was calibrated against the known clipped diagrams and the complete Mermaid 11 cookie diagram. All 32 views render successfully, with no page exceptions, Mermaid parse errors, or external requests. The previously clipped final lines now fit inside their label boxes.
Local validation on Node 24: build, lint, 669 tests, 100% type coverage, and Doom's documentation site build pass. Both versions' eight-diagram sites also build successfully.