Skip to content

Commit bb1aef9

Browse files
committed
Fix Mermaid diagram text truncation caused by section p styling
Root cause: section p { font-size: 1rem } override increased Mermaid node label text from 14px to 16px, causing foreignObject overflow and text clipping (e.g., "fifty-fifty" → "fifty-fi"). Solution: Added .mermaid p reset to inherit font-size/line-height/color from parent (.nodeLabel { font-size: 14px !important }), preventing global paragraph styles from breaking diagram layout. Regression introduced when MDX paragraph styling was added without scoping exclusions for SVG content.
1 parent 7339f43 commit bb1aef9

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/styles/global.css

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,34 @@ pre.mermaid,
236236
font-family: var(--diagram-font-family) !important;
237237
font-size: var(--diagram-font-size-annotation) !important;
238238
}
239+
240+
/* Reset paragraph styles inside Mermaid diagrams */
241+
/* Prevents section p { font-size: 1rem } from overriding diagram font sizes */
242+
.mermaid p {
243+
margin: 0;
244+
padding: 0;
245+
font-size: inherit;
246+
line-height: inherit;
247+
color: inherit;
248+
}
249+
250+
/* ===== MDX Native Paragraph Styling ===== */
251+
/* Style bare <p> tags from markdown (not inside components) */
252+
section p {
253+
font-size: 1rem; /* text-base */
254+
line-height: 1.75; /* leading-relaxed */
255+
color: var(--color-text-lighter); /* #475569 */
256+
margin-bottom: 1.5rem; /* mb-6 */
257+
}
258+
259+
section p strong {
260+
color: var(--color-text);
261+
font-weight: 600;
262+
}
263+
264+
/* Code blocks in sections */
265+
section pre {
266+
padding: 1rem 1.5rem; /* 16px 24px */
267+
border-radius: 0.5rem; /* 8px */
268+
margin-bottom: 1.5rem; /* mb-6 */
269+
}

0 commit comments

Comments
 (0)