fix(feishu): try post-type before falling back to text for markdown tables - #34181
Open
wydty wants to merge 1 commit into
Open
fix(feishu): try post-type before falling back to text for markdown tables#34181wydty wants to merge 1 commit into
wydty wants to merge 1 commit into
Conversation
…ables
Previously, _build_outbound_payload detected markdown tables and
pre-emptively forced text mode for any content containing table syntax.
This was a conservative fix for cases where Feishu's `md` tag rendered
tables as blank on some clients.
However, Feishu's Markdown renderer in the `post` message type does
support tables, and rendering varies by client version. The pre-emptive
force-to-text was overly conservative — it sacrificed all markdown
formatting (bold, code, lists, etc.) just because the message happened
to contain a table.
This change removes the pre-emptive table detection in
_build_outbound_payload, letting tables flow through the normal markdown
detection logic:
- Tables + other markdown (bold, code, etc.) → `post` type → `md` tag
→ Feishu renders the table on capable clients
- Tables only (no other markdown) → `text` type → raw markdown text
(unchanged from before, since _MARKDOWN_HINT_RE won't match)
- If the Feishu API rejects the post payload format → the existing
fallback in _send_message_chunks degrades to plain text automatically
The _MARKDOWN_TABLE_RE regex is retained as documentation but no longer
drives payload construction.
Contributor
|
Thanks for the focused table-rendering proposal. The underlying routing problem is still present on current main: Problems
Suggested changes
This is an automated hermes-sweeper review. |
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
_build_outbound_payload()pre-emptively forcestextmessage type for anycontent containing markdown tables, even when other markdown (bold, code,
lists) is also present. This sacrifices all formatting just because the
message happens to contain a table.
Feishu's
postmessage type withmdtag does support table renderingon most clients, though behavior varies by client version.
Solution
Remove the pre-emptive table detection from
_build_outbound_payload, lettingtables flow through the normal markdown detection logic:
posttype →mdtag→ Feishu renders the table on capable clients
texttype (unchanged from before)_send_message_chunksdegrades to plain text automaticallyThe
_MARKDOWN_TABLE_REregex is retained as documentation but no longerdrives payload construction.
Tests
All 397 existing feishu-related tests pass.