Skip to content

Commit 579c865

Browse files
unhappychoiceclaude
andcommitted
fix(frontend): pin mermaid look and layout to the pre-12 defaults
Mermaid 12 changed its defaults from look: 'classic' / layout: 'dagre' to look: 'neo' / layout: 'elk', which silently re-lays out and recolours every existing flowchart, state and class diagram. Pin both explicitly so the bump does not change rendering, and so the container CSS keeps matching the text metrics mermaid computes. Switching to ELK or the neo look stays a separate, deliberate change. Co-Authored-By: Claude Opus 5 <[email protected]>
1 parent 744dfad commit 579c865

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

‎packages/frontend/src/components/Content/MarkdownContent/MarkdownRenderer/MermaidRenderer.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ const MermaidRenderer: React.FC<MermaidProps> = ({ chart }) => {
6161
mermaid.initialize({
6262
startOnLoad: false,
6363
theme: theme.palette.mode === 'dark' ? 'dark' : 'neutral',
64+
// Mermaid 12 switched the defaults to look: 'neo' and layout: 'elk'.
65+
// Pin the previous defaults so diagrams keep rendering as before, and
66+
// so the container CSS above keeps matching what mermaid measures.
67+
look: 'classic',
68+
layout: 'dagre',
6469
securityLevel: 'loose',
6570
fontFamily: fontFamily || 'inherit',
6671
flowchart: {

‎packages/frontend/test/unit/components/Content/MarkdownContent/MarkdownRenderer/MermaidRenderer.test.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ describe('Mermaid', () => {
6767
expect(mermaid.initialize).toHaveBeenCalledWith({
6868
startOnLoad: false,
6969
theme: 'neutral',
70+
look: 'classic',
71+
layout: 'dagre',
7072
securityLevel: 'loose',
7173
fontFamily: 'MockFont, sans-serif',
7274
flowchart: {
@@ -81,6 +83,8 @@ describe('Mermaid', () => {
8183
expect(mermaid.initialize).toHaveBeenCalledWith({
8284
startOnLoad: false,
8385
theme: 'dark',
86+
look: 'classic',
87+
layout: 'dagre',
8488
securityLevel: 'loose',
8589
fontFamily: 'MockFont, sans-serif',
8690
flowchart: {

0 commit comments

Comments
 (0)