Bug Description
When copying a rendered Markdown table as Markdown, CSV, or TSV, line breaks inside table cells are lost from the text/plain clipboard representation.
The issue appears to be caused by extractTableDataFromElement(), which uses cell.textContent?.trim().
For a rendered cell such as <td>Paragraph one.<br>Paragraph two.</td>, textContent returns Paragraph one.Paragraph two.. The <br> is therefore lost before the table is serialized.
The HTML clipboard representation still contains the <br>, so rich-text paste and plain-text paste produce inconsistent results.
Steps to Reproduce
-
Render the following Markdown with Streamdown:
| Name | Description |
| --- | --- |
| Example | Paragraph one.<br>Paragraph two. |
-
Open the copy dropdown on the rendered table.
-
Select CSV or TSV.
-
Paste the copied content into a plain-text editor.
The problem can also be observed by reading the text/plain clipboard representation, for example with pbpaste on macOS.
Minimal example:
import { Streamdown } from "streamdown";
import "streamdown/styles.css";
const markdown = `
| Name | Description |
| --- | --- |
| Example | Paragraph one.<br>Paragraph two. |
`;
export default function App() {
return <Streamdown>{markdown}</Streamdown>;
}
Expected Behavior
Line breaks in table cells should be preserved when generating the plain-text Markdown, CSV, or TSV representation.
For CSV, the multiline field should contain a real newline and be quoted:
Example,"Paragraph one.
Paragraph two."
For TSV or Markdown, the line break should also be represented without merging the two paragraphs into one continuous string.
Actual Behavior
The line break is removed completely:
Example,Paragraph one.Paragraph two.
The two paragraphs are concatenated without a newline or even a separating space.
Pasting the same clipboard content into an application that reads the text/html representation may preserve the line break because the HTML still contains <br>. The problem affects the generated text/plain representation.
Code Sample
Streamdown Version
2.5.0
React Version
19.2.7
Node.js Version
No response
Browser(s)
No response
Operating System
None
Additional Context
No response
Bug Description
When copying a rendered Markdown table as Markdown, CSV, or TSV, line breaks inside table cells are lost from the
text/plainclipboard representation.The issue appears to be caused by
extractTableDataFromElement(), which usescell.textContent?.trim().For a rendered cell such as
<td>Paragraph one.<br>Paragraph two.</td>,textContentreturnsParagraph one.Paragraph two.. The<br>is therefore lost before the table is serialized.The HTML clipboard representation still contains the
<br>, so rich-text paste and plain-text paste produce inconsistent results.Steps to Reproduce
Render the following Markdown with Streamdown:
Open the copy dropdown on the rendered table.
Select CSV or TSV.
Paste the copied content into a plain-text editor.
The problem can also be observed by reading the
text/plainclipboard representation, for example withpbpasteon macOS.Minimal example:
Expected Behavior
Line breaks in table cells should be preserved when generating the plain-text Markdown, CSV, or TSV representation.
For CSV, the multiline field should contain a real newline and be quoted:
For TSV or Markdown, the line break should also be represented without merging the two paragraphs into one continuous string.
Actual Behavior
The line break is removed completely:
The two paragraphs are concatenated without a newline or even a separating space.
Pasting the same clipboard content into an application that reads the
text/htmlrepresentation may preserve the line break because the HTML still contains<br>. The problem affects the generatedtext/plainrepresentation.Code Sample
Streamdown Version
2.5.0
React Version
19.2.7
Node.js Version
No response
Browser(s)
No response
Operating System
None
Additional Context
No response