Skip to content

feat: add data attributes to markdown components#48

Merged
haydenbleasel merged 3 commits intomainfrom
14-feature-request-add-data-attributes-to-markdown-components
Aug 27, 2025
Merged

feat: add data attributes to markdown components#48
haydenbleasel merged 3 commits intomainfrom
14-feature-request-add-data-attributes-to-markdown-components

Conversation

@haydenbleasel
Copy link
Contributor

This pull request adds data-streamdown attributes to various React components in the packages/streamdown/lib/components.tsx file. These attributes help identify and target specific rendered elements for downstream processing, testing, or styling. The changes cover a wide range of elements, including code blocks, lists, headings, tables, and inline formatting components.

Component attribute additions:

  • Added data-streamdown attributes to code-related components, including inline code, mermaid blocks, and standard code blocks, as well as specifying the language for code blocks. [1] [2] [3]
  • Applied data-streamdown attributes to list elements (ol, ul, li), horizontal rules (hr), and strong text (span).
  • Enhanced all heading components (h1 through h6) with corresponding data-streamdown attributes for easier identification. [1] [2]
  • Updated table-related components (wrapper, table, header, body, rows, header cells, and cells) with specific data-streamdown attributes for improved targeting and structure recognition. [1] [2]
  • Added data-streamdown attributes to blockquotes, superscript, and subscript components for more granular element selection. [1] [2]

Documentation:

  • Updated the changeset to document the addition of data-streamdown attributes to components.

Added data-streamdown attributes to various rendered components for improved DOM identification and targeting. This enhances testability and integration with other tools that rely on custom data attributes.
@haydenbleasel haydenbleasel linked an issue Aug 27, 2025 that may be closed by this pull request
@vercel
Copy link
Contributor

vercel bot commented Aug 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
streamdown Ready Ready Preview Comment Aug 27, 2025 1:10am

@haydenbleasel haydenbleasel merged commit 13898aa into main Aug 27, 2025
6 checks passed
@haydenbleasel haydenbleasel deleted the 14-feature-request-add-data-attributes-to-markdown-components branch August 27, 2025 03:45
own-boldsbrain pushed a commit to own-boldsbrain/streamdown that referenced this pull request Sep 22, 2025
* Add data-streamdown attributes to components

Added data-streamdown attributes to various rendered components for improved DOM identification and targeting. This enhances testability and integration with other tools that rely on custom data attributes.

* Create little-buses-lick.md

* Update verify-changesets.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Add data attributes to markdown components

1 participant