Desktop: mermaid image nodes render without the image

オープン 初心者向け
#62,893 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
77/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
desktop

調査の方向性

packages/session-ui/src/components/markdown-mermaid.ts から始めて、Pele renderAsync のオプション、特に images: false を調べてください。Desktop Review ペインで Mermaid の画像ノードがどのように描画されるか、また画像の描画を有効にしても既存の 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分
マージ済み PR(30日)
554

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode のほかの issue

anomalyco/opencode の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。