Skip to content

Table element receives incorrect data-streamdown attribute (table-wrapper instead of table) #314

@matzkoh

Description

@matzkoh

Bug Description

The inner <table> element incorrectly receives data-streamdown="table-wrapper" instead of data-streamdown="table". This breaks CSS selectors targeting [data-streamdown="table"].

Steps to Reproduce

  1. Render any markdown with a table using Streamdown
  2. Inspect the rendered HTML
  3. Check the data-streamdown attribute on the <table> element

Expected Behavior

  • Wrapper <div> should have data-streamdown="table-wrapper"
  • Inner <table> should have data-streamdown="table"

Actual Behavior

  • Wrapper <div> has data-streamdown="table-wrapper"
  • Inner <table> has data-streamdown="table-wrapper" ✗ (should be table)

Code Sample

import { Streamdown } from 'streamdown';

const markdown = `
| Header 1 | Header 2 |
|----------|----------|
| Cell 1   | Cell 2   |
`;

// Rendered output shows <table data-streamdown="table-wrapper"> instead of <table data-streamdown="table">
<Streamdown>{markdown}</Streamdown>

Root Cause

In packages/streamdown/lib/components.tsx, MemoTable passes data-streamdown="table-wrapper":

<Table
  className={className}
  data-streamdown="table-wrapper"  // ← passed here
  {...props}
>

In packages/streamdown/lib/table/index.tsx, this is spread after data-streamdown="table":

<table
  data-streamdown="table"
  {...props}  // ← overwrites with "table-wrapper"
>

Streamdown Version

1.6.10

React Version

18.3.1

Node.js Version

20.x

Browser(s)

Chrome

Operating System

macOS

Additional Context

Suggested fix: Remove data-streamdown="table-wrapper" from MemoTable in components.tsx, since the Table component already sets this on its wrapper div.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions