Skip to content

feat: MarkdownBody 支持轻量 Mermaid 图表/源码切换 - #91

Open
hifizz wants to merge 1 commit into
mainfrom
codex/markdown-mermaid
Open

feat: MarkdownBody 支持轻量 Mermaid 图表/源码切换#91
hifizz wants to merge 1 commit into
mainfrom
codex/markdown-mermaid

Conversation

@hifizz

@hifizz hifizz commented Sep 6, 2026

Copy link
Copy Markdown
Owner

变更

  • 在共享 MarkdownBody 中识别 mermaid 围栏,正文与 Markdown Artifact 同时支持。
  • 复用已有 beautiful-mermaid 依赖,按需加载;默认图表,提供低存在感的「图表/源码」文字按钮。
  • 透明背景、沿用正文语义配色;大图在自身区域滚动,不撑开正文。
  • 流式期间显示静态占位,结束后绘图;库抛错或图片加载失败时回退源码。
  • SVG 通过 data URI 图片隔离,不将图内脚本、样式和重复 id 注入正文 DOM。
  • 接入 Markdown 渲染结算批次;切换时保留源码 DOM。
  • 不修改 System prompt 或新增工具定义,标准 mermaid 代码块即可触发显示。

验证

  • 通过:pnpm typecheck。
  • 通过:修改的 TSX 文件 ESLint、git diff --check。
  • 通过:现有 markdown-settlement 测试。
  • 通过:独立浏览器端打包检查。
  • 通过:流程图、时序图、状态图、类图、ER、XY 六类 SVG 渲染及 URI 编解码;不支持的图种、无效头和空源码抛错检查。
  • 尚未完成:浏览器交互与截图验收。环境缺少浏览器,Chromium 下载超时;不能将打包检查视为实际浏览器验收。

人工验收建议

  • 检查桌面和移动端图表/源码切换、深浅主题、宽图局部滚动。
  • 检查流式结束、绘图失败、后续正文更新后的渲染完成状态。
  • 回归划选引用、锚点高亮与 Artifact 阅读。

保持 main 不变,待审查后合并。

@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
thread-chatbot Error Error Sep 6, 2026 2:00am UTC

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: f02a8d4e-ae13-41d2-b8f6-7858dc73ad1c


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant