Desktop: mermaid image nodes render without the image

未关闭 适合新手
#62,893 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
77/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
desktop

调研方向

从 packages/session-ui/src/components/markdown-mermaid.ts 开始,检查 Pele renderAsync 选项,尤其是 images: false。查看 Mermaid 图像节点在 Desktop Review 面板中的渲染方式,并确认启用图像渲染是否能保留现有的 Markdown 行为。完成标准是流程图中的图像节点显示图像,而不是空白区域。

由索引模型根据 Issue 内容生成。

描述

reproduced
Description

Mermaid image nodes (node@{ img: "..." }) show only their label in the Markdown viewer. The image is missing. Normal Markdown images in the same file (![x](assets/x.png)) display correctly.

The cause seems to be ./packages/session-ui/src/components/markdown-mermaid.ts, which calls Pele with images: false:

const result = await pele.renderAsync(source, {
  ...
  images: false,
})

With this option, Pele leaves the <image> element out of the SVG but still reserves the space for it, so the node shows only its label above an empty gap.

Plugins

No response

OpenCode version

2.2.6

Steps to reproduce
  1. Create a markdown file with:
    ![image](assets/image.png)
    
    ```mermaid
    flowchart TB
      a["start"]
      b@{ img: "assets/image.png", label: "image node", pos: "b", w: 90, h: 53, constraint: "on" }
      c@{ img: "https://mermaid.js.org/favicon.svg", label: "remote image", pos: "b", w: 60, h: 60 }
      a --> b --> c
    ```
    
  2. Open the file in the desktop Review pane.
  3. The Markdown image shows, but nodes b and c show only their labels with empty space.
Screenshot

No response

Operating System

Mac OS

Terminal

No response

主要语言
TypeScript
星标
225k
派生
30.4k
平均合并
4 小时 7 分钟
30 天内合并 PR
554

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。