feat: add mermaid diagram rendering to FileViewer markdown preview with zoom modal#182
Open
Kabochar wants to merge 3 commits into
Open
feat: add mermaid diagram rendering to FileViewer markdown preview with zoom modal#182Kabochar wants to merge 3 commits into
Kabochar wants to merge 3 commits into
Conversation
Extract MermaidBlock and CodeBlock from MarkdownBody into a shared component. Use them in FileViewer's TextFileViewer markdown preview so mermaid diagrams render the same way as in chat messages. - MermaidBlock defaults to preview mode (no manual toggle needed) - Non-mermaid code blocks use CodeBlock for consistent styling - Streaming messages still fall back to source view via isStreaming - 5 unit tests covering SSR initial state, streaming, and edge cases
Click a rendered mermaid SVG to open a full-screen zoom modal with: - Wheel zoom (no upper bound) and drag-to-pan - Fit-to-screen on open (auto-scale to fill viewport) - Reset button, Escape / backdrop-click to close - Body scroll lock and mobile-friendly touch-action
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.
改动:
FileViewer markdown 预览支持 mermaid 渲染 — 将 MermaidBlock 和 CodeBlock 从 MarkdownBody 提取为共享组件。FileViewer 的 markdown 预览现在以和聊天消息一致的方式渲染 mermaid 图表,包括预览模式和一致的代码块样式。
Mermaid 缩放弹窗 — 点击已渲染的 mermaid SVG 打开全屏缩放弹窗,支持:
测试覆盖:
文件变更:
components/MermaidBlock.tsx — 新增共享组件 (从 MarkdownBody 提取)
components/MermaidBlock.test.mjs — 5 个单测
components/MarkdownBody.tsx — 重构: 提取 mermaid/code block 逻辑
components/FileViewer.tsx — 在 markdown 预览中使用 MermaidBlock
app/globals.css — 缩放弹窗样式