fix(feishu): wrap markdown tables in code fences for post rendering - #22222
Closed
asdlem wants to merge 2 commits into
Closed
fix(feishu): wrap markdown tables in code fences for post rendering#22222asdlem wants to merge 2 commits into
asdlem wants to merge 2 commits into
Conversation
Previously, messages containing markdown tables were forced into plain-text mode because Feishu's post-type 'md' elements don't render tables. This lost all other markdown formatting (bold, links, code blocks) for the entire message. Now, markdown tables are converted to fenced code blocks while keeping the message in post mode. The rest of the message renders with full markdown, and tables display as monospace text. - Add _convert_markdown_tables_to_code_blocks() helper - Add _is_table_header_line() table detection - Remove the has_table → text-mode fallback in _build_outbound_payload()
Collaborator
Contributor
Author
|
Closing: wrong approach. Will re-submit with correct fix. |
Contributor
|
Closing comment body. |
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
Previously, when a message contained a markdown table,
_build_outbound_payload()forced the entire message into plain-text mode ("text"type). This was because Feishu's post-typemdelements don't render tables, and sending tables as post caused the message to appear blank.This PR changes the approach: instead of dropping the whole message to plain text (losing all formatting), markdown tables are now wrapped in code fences and kept in post mode. The result is that bold, links, and code blocks render correctly while tables display as monospace text — an improvement over losing all formatting.
Changes
gateway/platforms/feishu.py_convert_markdown_tables_to_code_blocks()— wraps each standalone markdown table in a code fence, while respecting existing fenced blocks_is_table_header_line()— detects start-of-table lines_MARKDOWN_TABLE_RE→ text-mode fallback in_build_outbound_payload()Test Plan