Skip to content

feat(markdown-renderer): add CSV download button for tables#1813

Draft
Killusions wants to merge 3 commits intomainfrom
feat/markdown-renderer-table-download
Draft

feat(markdown-renderer): add CSV download button for tables#1813
Killusions wants to merge 3 commits intomainfrom
feat/markdown-renderer-table-download

Conversation

@Killusions
Copy link
Copy Markdown
Member

@Killusions Killusions commented Apr 2, 2026

Merge after #1810 and #1811

Adds a button to download tables as CSV to the rendered markdown (with a translatable label)


Documentation.
Examples.
Dashboards Demo.
Playwright report.

Coverage Reports:

Code Coverage

Add max-inline-size constraint to message bubble and wrapper to prevent
overflow. Fix attachment preview backdrop click behavior. Use index-based
tracking for message list and add scroll-to-bottom on message send.
Update example action labels for clarity.
…line and caching

Rewrite the markdown renderer to use a recursive processing pipeline with
placeholder-based architecture. Add SSR support via optional doc/isBrowser
parameters. Introduce LRU caching for code blocks and tables. Improve
table rendering with proper thead/th support. Add code-wrapper structure
with language labels. Update SCSS for new structural layout including
code-wrapper, table-wrapper, and table-scroll-container.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the markdown renderer to support server-side rendering and introduces LRU caching for code blocks and tables. It adds CSV export functionality for tables and updates the SiMarkdownRendererComponent to utilize Angular signals and computed properties. Styles for chat messages were improved for responsiveness, and action labels were updated for better clarity. Feedback was provided to use currentTarget in the table download logic to ensure the button element is correctly targeted when its internal icon is clicked.

if (isInBrowser) {
div.querySelectorAll('.download-table-btn').forEach(btn => {
btn.addEventListener('click', e => {
const button = e.target as HTMLButtonElement;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using e.target can be problematic if the user clicks on the icon inside the button, as e.target would then refer to the element. Use e.currentTarget instead, which always refers to the element the event listener was attached to (the button).

Suggested change
const button = e.target as HTMLButtonElement;
const button = e.currentTarget as HTMLButtonElement;

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.

1 participant