fix(feishu): send markdown tables as post instead of forcing plain text - #57538
Closed
xielevi wants to merge 1 commit into
Closed
fix(feishu): send markdown tables as post instead of forcing plain text#57538xielevi wants to merge 1 commit into
xielevi wants to merge 1 commit into
Conversation
The _build_outbound_payload method detected markdown tables via _MARKDOWN_TABLE_RE and forced msg_type="text", which rendered tables as raw pipe-delimited text (| col | col |). This is strictly worse than sending as post — Feishu's post md tag now renders tables correctly, and the existing fallback in send_message() already catches post payload rejections and retries as plain text. The table detection regex is still used: it now triggers the post path (same as other markdown hints) instead of the text fallback. Tested with headers, lists, code blocks, tables, links, blockquotes — all render correctly in Feishu client. Refs: #21866, #27469
Collaborator
Duplicate of #27922 — this is part of the long-standing Feishu markdown-table rendering cluster (meta #27469). At least six open PRs (#27922, #28030, #31410, #34181, #36637, #38867) apply the same fix: remove the |
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.
Problem
When Hermes sends a Feishu message containing a markdown table,
_build_outbound_payloaddetects the table via_MARKDOWN_TABLE_REand forcesmsg_type="text". This renders the table as raw pipe-delimited text (| col | col |), which is strictly worse than any alternative.Related issues: #21866, #27469
Fix
Remove the table→text fallback and let tables take the same
postpath as other markdown content. The_MARKDOWN_TABLE_REregex now triggers thepostbranch (alongside_MARKDOWN_HINT_RE) instead of thetextfallback.Safety
The existing
send_message()method already catches post payload rejections from the Feishu API (_POST_CONTENT_INVALID_RE) and falls back to plain text with_strip_markdown_to_plain_text(). This safety net remains intact — if the post payload is rejected, the user still gets the message, just without formatting.Testing
Verified with the following markdown elements in Feishu client — all render correctly:
Notes
hermes-lark-streamingplugin installed, this code path is typically bypassed (streaming cards setalready_sent=True), but the fix ensures correct behavior for all users regardless of plugin setup.msg_type="interactive"Card 2.0 for tables) would be a separate enhancement. This PR is the minimal fix that removes the actively harmful fallback.