feat: 优化 Mermaid 图表尺寸显示

- 添加 SVG 最大高度限制(桌面端 600px)
- 使用 Flexbox 实现图表在容器中居中显示
- 添加响应式适配(平板 500px,手机 400px)
- 设置容器最小高度 100px,避免空白过小
- 使用 width: auto !important 保持图表原始宽高比
- 创建尺寸优化测试文件和文档

解决问题:
- 低内容图表(2-3 节点)不再显示过大
- 图表尺寸更加合理,视觉协调
- 复杂图表高度限制,出现滚动条
- 移动端体验优化
This commit is contained in:
2026-01-24 22:58:28 +08:00
parent 28f0a1265e
commit d0ae1dbed7
3 changed files with 583 additions and 0 deletions

View File

@@ -919,12 +919,17 @@ article .wp-block-separator {
max-width: 100%;
opacity: 0;
animation: mermaidFadeIn 0.3s ease-in-out forwards;
display: flex;
justify-content: center;
align-items: center;
}
.mermaid-container svg {
max-width: 100%;
max-height: 600px;
height: auto;
display: block;
width: auto !important;
}
/* Mermaid 淡入动画 */
@@ -16631,11 +16636,17 @@ html.darkmode .mermaid-error-container .error-code code {
overflow-x: auto;
max-width: 100%;
transition: opacity 0.3s ease-in;
display: flex;
justify-content: center;
align-items: center;
min-height: 100px;
}
.mermaid-container svg {
max-width: 100%;
max-height: 600px;
height: auto;
width: auto !important;
display: block;
margin: 0 auto;
}
@@ -16664,6 +16675,7 @@ html.darkmode .mermaid-container {
.mermaid-container svg {
max-width: 100%;
max-height: 500px;
}
}
@@ -16672,6 +16684,10 @@ html.darkmode .mermaid-container {
padding: 10px;
margin: 10px 0;
}
.mermaid-container svg {
max-height: 400px;
}
}
/* ---------- Mermaid 错误提示样式 ---------- */