Table copy and download lose header cells in body rows, image cells, and tables without a header row

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

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

@AbbasFullstack がすでに取り組んでいます。

2026年11月12日 から。

評価

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

調査の方向性

表の抽出処理は extractTableDataFromElement と tableDataToMarkdown にあります。まず、本文の行がどのように選択されるか、画像セルがどのように読み取られるかを読んでください。issue にある2つの表で再現してください。1つ目は alt テキストを保持する必要があり、2つ目は空のヘッダー行を持つ有効な Markdown として Revenue と Costs を保持する必要があります。両方のコピー経路がすべてのセルを保持し、既存の表のテストが引き続き成功すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Bug Description

Table copy and download (Markdown, CSV and TSV) read the table with extractTableDataFromElement, which loses content in three cases:

  1. Header cells in body rows are dropped. It reads only td in tbody tr. This happens with HTML tables that use row headers, such as <tr><th>Revenue</th><td>100</td></tr>.
  2. Images lose their alt text. It takes only text content. A cell with ![Acme logo](...) is copied as "Image not available" if the image failed to load, or as an empty cell if it loaded.
  3. A table without a header row copies as an empty string. tableDataToMarkdown returns "" when there are no headers, so the whole table is lost.
Steps to Reproduce
  1. Open https://streamdown.ai/playground and replace the input with:
    | Logo | Name |
    | --- | --- |
    | ![Acme logo](https://example.com/logo.png) | Acme |
    
    <table><tbody><tr><th>Revenue</th><td>100</td></tr><tr><th>Costs</th><td>40</td></tr></tbody></table>
    
  2. On the first table, choose Copy table → Markdown.
  3. On the second table, choose Copy table → Markdown.
Expected Behavior
  • First table: | Acme logo | Acme |, or Markdown image syntax for the cell.
  • Second table: a valid table that keeps every cell, including Revenue and Costs. For example, it could use an empty header row so the GFM table stays valid.
Actual Behavior
  • First table: | Image not available | Acme |, because the image failed to load. From the source, a loaded image gives an empty cell.
  • Second table: an empty string. From the source, CSV and TSV keep only 100 and 40; the row headers are lost.
Code Sample
<Streamdown>
  {"<table><tbody><tr><th>Revenue</th><td>100</td></tr></tbody></table>"}
</Streamdown>
Streamdown Version

2.7.1

React Version

19.3.1

Browser(s)

Chrome (desktop)

Operating System

macOS

Additional Context

Possible fixes in extractTableDataFromElement / tableDataToMarkdown:

  • read th, td in body rows;
  • use img.alt (or ![alt](src)) for image cells, and skip the image fallback and download button;
  • when there are no headers, emit an empty header row and delimiter rather than returning "".

Related: #553 (line breaks in cells), which is already fixed.

主要言語
TypeScript
スター
5.8k
フォーク
334
平均マージ
2日 4時間
マージ済み PR(30日)
33

環境構築

はじめの一歩

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

vercel/streamdown のほかの issue

vercel/streamdown の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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