feat(feishu): render markdown tables as Feishu interactive card table elements - #27768
Closed
jefferyzhang963 wants to merge 1 commit into
Closed
feat(feishu): render markdown tables as Feishu interactive card table elements#27768jefferyzhang963 wants to merge 1 commit into
jefferyzhang963 wants to merge 1 commit into
Conversation
… elements Convert markdown tables in outbound messages to Feishu interactive-card JSON 2.0 native `table` elements instead of falling back to plain text. Previously, the adapter detected markdown tables and forced plain-text rendering because Feishu's post-type 'md' elements cannot render tables. Now it builds an interactive card with alternating `markdown` (for surrounding prose) and `table` (for each detected table) elements. Changes: - Add markdown table parser and card builder functions - Modify _build_outbound_payload to return interactive cards for tables - Add interactive-card failure fallbacks in send() and edit_message() - 18 new tests covering parsing, card generation, send/edit paths, and API error fallbacks Fixes the issue where reply text disappears on Feishu client when the message contains markdown tables.
23 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Convert markdown tables in outbound Feishu messages to interactive-card JSON 2.0 native
tableelements instead of falling back to plain text.Problem
Feishu post-type
mdelements cannot render markdown tables — sending table content as post causes the message to appear blank on the client. The workaround was to force plain text for anything that looked like a markdown table (_MARKDOWN_TABLE_RE). This makes tables barely readable.Solution
When
_build_outbound_payloaddetects a markdown table, it now:markdownelements for surrounding prosetableelements (withlark_mddata type) for each detected tableThe card uses
wide_screen_mode: trueandrow_height: "low"for compact rendering.Changes
gateway/platforms/feishu.py(+207 / -11)_is_table_separator_row,_parse_table_row,_pad_row,_parse_markdown_table,_split_content_by_tables,_build_table_card_element,_build_interactive_table_card_build_outbound_payload: table detection now returns("interactive", card_json)instead of("text", ...)send(): added interactive-card failure fallback (exception + response check)edit_message(): added interactive-card failure fallbacktests/gateway/test_feishu.py(+333)TestFeishuMarkdownTableCardcovering:_build_outbound_payloadintegration (returns interactive for table, post for non-table)send()integration (interactive card sends, API error fallback, response failure fallback)edit_message()integrationVerification
Screenshots
Before: plain text table → barely readable
After: native Feishu card table with proper column alignment, inline markdown rendering