Skip to content

feat(feishu): render markdown tables as native card tables - #53071

Open
kreshan1997-alt wants to merge 1 commit into
NousResearch:mainfrom
kreshan1997-alt:feat/feishu-table-card
Open

feat(feishu): render markdown tables as native card tables#53071
kreshan1997-alt wants to merge 1 commit into
NousResearch:mainfrom
kreshan1997-alt:feat/feishu-table-card

Conversation

@kreshan1997-alt

@kreshan1997-alt kreshan1997-alt commented Jun 26, 2026

Copy link
Copy Markdown

Problem

Feishu post-type messages do not render markdown tables. When the agent responds with table content, it appears blank or as raw pipe-separated text. Current workaround forces plain text for any content containing a table, losing all formatting.

Solution

Detect markdown tables in outbound messages and send them as interactive cards with a native table element (Feishu card schema 2.0), while preserving surrounding markdown text.

Changes

  1. _parse_md_table_content() — Parse markdown table structure and split surrounding text
  2. _build_table_card_payload() — Build Feishu 2.0 card with table element
  3. _build_outbound_payload() — Route tables as interactive msg_type
  4. Fallback in send() — Degrade interactive cards to plain text on API rejection

Testing

Verified on live Feishu bot with various table sizes and mixed content. Fallback confirmed on API rejection.

Feishu post-type messages do not render markdown tables, causing table
content to appear blank or as raw pipe-separated text. This change
detects markdown tables in outbound messages and sends them as
interactive cards with a native table element (schema 2.0).

Changes:
- Add _parse_md_table_content() to extract table structure and
  surrounding text from markdown content
- Add _build_table_card_payload() to construct a Feishu card JSON
  with table element, including before/after markdown context
- Modify _build_outbound_payload() to route tables as 'interactive'
  msg_type instead of forcing plain text
- Add fallback logic in send() to degrade interactive cards to plain
  text on API rejection (matching existing post-type fallback)
@alt-glitch alt-glitch added type/feature New feature or request comp/plugins Plugin system and bundled plugins platform/feishu Feishu / Lark adapter P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Jun 26, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #12114 — same native Feishu Card 2.0 table-element rendering for markdown tables, the earliest-open PR in a heavily saturated cluster (#40445, #38453, #31038, #46727, #26429). Tracking the canonical there.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for addressing a real Feishu rendering limitation: current main deliberately falls back to plain text for detected markdown tables at plugins/platforms/feishu/adapter.py:4524-4530.

Problems

  • The new parser uses one _MARKDOWN_TABLE_RE.search() and places all later content in a markdown element. A second table in the same response would remain markdown, despite the current adapter documenting that this renderer does not support tables.
  • edit_message() also uses _build_outbound_payload() at plugins/platforms/feishu/adapter.py:1958, but its fallback remains msg_type == "post" at line 1963. The submitted fallback change covers send() only.
  • The diff changes no tests, leaving table segmentation and both interactive fallback paths unprotected.

Suggested changes

  • Segment all recognized tables in order and cover multi-table content.
  • Apply a consistent interactive fallback to both send and edit paths, then add regression tests under tests/gateway/.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have platform/feishu Feishu / Lark adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants