Skip to content

feat(feishu): support markdown tables via CardKit table element (JSON 2.0 schema)#31038

Open
wangzxjh wants to merge 1 commit into
NousResearch:mainfrom
wangzxjh:feat/feishu-cardkit-table-support
Open

feat(feishu): support markdown tables via CardKit table element (JSON 2.0 schema)#31038
wangzxjh wants to merge 1 commit into
NousResearch:mainfrom
wangzxjh:feat/feishu-cardkit-table-support

Conversation

@wangzxjh

Copy link
Copy Markdown

Problem

Feishu post type messages do not render markdown tables — they display as raw | characters, making table-formatted data unreadable.

Solution

Detect code blocks (`) and markdown tables via regex and route them to a JSON 2.0 interactive card with native CardKit table elements instead of post or plain text.

Key changes

  • _build_card_payload_from_blocks() — splits content into markdown and table elements, builds a JSON 2.0 card
  • _build_card_table_element() — parses markdown tables into CardKit table components
  • _split_into_card_elements() — interleaves text and table blocks preserving original order
  • _send_interactive_via_rest() — sends interactive cards via direct REST API (lark-oapi SDK does not handle JSON 2.0 schema correctly for msg_type=interactive)
  • _feishu_send_with_retry() — routes msg_type=interactive to REST path
  • _build_outbound_payload() — detects code blocks and markdown tables, returns interactive cards

Backwards Compatibility

  • Non-code/non-table messages pass through unchanged (text or post as before)
  • Card failures cascade: interactive → post → text
  • _build_card_code_payload() kept as backward-compat alias

Closes #27695

… 2.0 schema)

Feishu post-type messages do not render markdown tables — they display as
raw | characters. This adds detection of code blocks and markdown tables in
_build_outbound_payload(), routing them to interactive cards (JSON 2.0
schema) instead of text or post.

Changes:
- _build_card_payload_from_blocks(): builds a JSON 2.0 card with mixed
  markdown + table elements
- _build_card_table_element(): parses markdown tables into native CardKit
  table components with proper columns and rows
- _split_into_card_elements(): interleaves text and table blocks preserving
  original order
- _get_tenant_access_token() + _send_interactive_via_rest(): sends
  interactive cards via direct REST API (lark-oapi SDK does not handle
  JSON 2.0 card schema correctly for msg_type=interactive)
- _feishu_send_with_retry(): routes msg_type=interactive to REST path
- _build_outbound_payload(): detects code blocks and markdown tables
  and returns interactive cards instead of text/post

Closes NousResearch#27695
@alt-glitch alt-glitch added type/feature New feature or request comp/gateway Gateway runner, session dispatch, delivery platform/feishu Feishu / Lark adapter P2 Medium — degraded but workaround exists labels May 23, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Closes #27695. Part of the Feishu markdown rendering consolidation tracked in #27469. Competing/related PRs: #23494, #19038 (closed). This is the most current implementation attempt for CardKit 2.0 table support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(feishu): support markdown tables via CardKit table element

2 participants