feat(feishu): use interactive card messages for markdown rendering#21000
Open
Only-Code-A wants to merge 2 commits intoNousResearch:mainfrom
Open
feat(feishu): use interactive card messages for markdown rendering#21000Only-Code-A wants to merge 2 commits intoNousResearch:mainfrom
Only-Code-A wants to merge 2 commits intoNousResearch:mainfrom
Conversation
56b8b5a to
7c263e6
Compare
…n support
Feishu's legacy card JSON 1.0 markdown elements have severely limited rendering:
- No heading support (## renders as raw text)
- No table support (| xxx | not rendered)
- No blockquote support (> not rendered)
- Tables in responses caused blank messages (had a workaround forcing plain text)
Upgrade to Card JSON 2.0 structure which uses rich text markdown elements that
render the full markdown spec reliably across all Feishu clients:
- Headings (# ## ###)
- Tables (| header | with separator rows)
- Blockquotes (> quoted text)
- Bold, italic, strikethrough, inline code
- Code blocks with language highlighting
- Ordered/unordered lists with nesting
- Links and emoji
Changes:
- Add Card JSON 2.0 schema declaration ("schema": "2.0")
- Move elements under body.elements (2.0 structure requirement)
- Update _build_markdown_card_payload() to produce Card JSON 2.0 structure
- Remove legacy workarounds (table-to-plain-text fallback no longer needed)
- Update fallback logic in send/edit/retry to handle 'interactive' type
alongside 'post'
7c263e6 to
6e75618
Compare
The adapter now uses interactive card messages (Card JSON 2.0) instead of post-type messages for markdown content. Update 6 test assertions: - msg_type 'post' → 'interactive' - payload structure from zh_cn.content rows to schema 2.0 body.elements - element tag from 'md' to 'markdown', key from 'text' to 'content'
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
Upgrade Feishu card messages from Card JSON 1.0 to Card JSON 2.0 structure, enabling full markdown rendering including headings, tables, and blockquotes.
Problem
The legacy Card JSON 1.0 markdown elements have severely limited rendering:
## Headingrenders as raw text| Table |not rendered at all> Blockquotenot renderedSolution
Upgrade to Card JSON 2.0 (
"schema": "2.0") which uses rich text markdown elements supporting the full markdown spec:Changes
"schema": "2.0"declaration to card payloadelementsunderbody.elements(2.0 structure requirement)_build_markdown_card_payload()to produce Card JSON 2.0 structureinteractivetype alongsidepostTesting
Manually verified on Feishu client (desktop + mobile):