From a143667ecbd3f95f53b64e036db3b592a3cc6a83 Mon Sep 17 00:00:00 2001 From: hikari0511 <83998395+hikari0511@users.noreply.github.com> Date: Fri, 15 May 2026 23:42:07 +0800 Subject: [PATCH] feat(feishu): render markdown tables as JSON 2.0 cards Feishu's post-type 'md' elements do not support markdown tables, causing table content to render as ugly plain text with pipe characters. This change detects markdown table content and sends it as an interactive card with schema 2.0, which natively renders tables with proper borders, alignment, and pagination (max 5 data rows). The card format is: { schema: '2.0', body: { elements: [{ tag: 'markdown', content: ... }] } } --- gateway/platforms/feishu.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gateway/platforms/feishu.py b/gateway/platforms/feishu.py index ae3f707510463..461f14b0501cc 100644 --- a/gateway/platforms/feishu.py +++ b/gateway/platforms/feishu.py @@ -4179,8 +4179,16 @@ def _build_outbound_payload(self, content: str) -> tuple[str, str]: # table content as post causes the message to appear blank on the client. # Force plain text for anything that looks like a markdown table. if _MARKDOWN_TABLE_RE.search(content): - text_payload = {"text": content} - return "text", json.dumps(text_payload, ensure_ascii=False) + # JSON 2.0 card renders markdown tables natively with borders and alignment. + card = { + "schema": "2.0", + "body": { + "elements": [ + {"tag": "markdown", "content": content} + ] + }, + } + return "interactive", json.dumps(card, ensure_ascii=False) if _MARKDOWN_HINT_RE.search(content): return "post", _build_markdown_post_payload(content) text_payload = {"text": content}