Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/mermaid-label-clipping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@alauda/doom": patch
---

Fix clipped Mermaid labels by measuring diagrams inside their display container. This keeps label dimensions consistent with the documentation page's typography, including multiline labels.
2 changes: 2 additions & 0 deletions packages/doom/src/runtime/components/Mermaid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ export const Mermaid = ({ className, children }: MermaidProps) => {
mermaid.initialize({ theme: isDark ? 'dark' : 'default' })

const render = async () => {
// Measure labels with the same document styles used to display the SVG.
const { svg, diagramType, bindFunctions } = await mermaid.render(
`mermaid-${id.slice(1, -1)}`,
children,
container,
)

container.classList.add(diagramType)
Expand Down
Loading