Skip to content

fix(feishu): render markdown tables via post+md instead of force-text - #27739

Closed
hupp1203-cmd wants to merge 1 commit into
NousResearch:mainfrom
hupp1203-cmd:fix/feishu-table-rendering
Closed

hupp1203-cmd wants to merge 1 commit into
NousResearch:mainfrom
hupp1203-cmd:fix/feishu-table-rendering

Conversation

@hupp1203-cmd

Copy link
Copy Markdown

Feishu post-type messages with tag:md support full GFM markdown including tables. The _MARKDOWN_TABLE_RE force-text fallback in _build_outbound_payload was downgrading any message containing a table to plain text, stripping ALL markdown formatting.
Fix:

What does this PR do?

Fixes Feishu/Lark message rendering for content containing markdown tables.
In v0.14.0, _build_outbound_payload uses _MARKDOWN_TABLE_RE to detect tables and forces the entire message to plain text type. While this prevented blank rendering (the original concern), it strips ALL markdown formatting — bold, italic, code blocks, links — making complex AI responses unreadable.
This PR routes table-containing content through post with tag:md elements, which natively support GFM tables. Tested on Feishu 7.x client.

Related Issue

Fixes #27529

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • gateway/platforms/feishu.py: Add _TABLE_BLOCK_RE regex for table detection
  • gateway/platforms/feishu.py: Modify _build_outbound_payload to route table content through post instead of text
  • gateway/platforms/feishu.py: Update _build_markdown_post_rows docstring

How to Test

  1. Start Hermes gateway with Feishu platform
  2. Send a message that generates a markdown table response
  3. Verify tables render correctly with bold/italic/code blocks preserved

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes
  • I've tested on my platform: Ubuntu 24.04, Feishu 7.x

Documentation & Housekeeping

  • I've updated relevant documentation — N/A (docstring only)
  • I've updated cli-config.yaml.example — N/A
  • I've updated CONTRIBUTING.md or AGENTS.md — N/A
  • I've considered cross-platform impact — N/A (Feishu-only)
  • I've updated tool descriptions/schemas — N/A

Feishu post-type messages with tag:md support full GFM markdown
including tables. The _MARKDOWN_TABLE_RE force-text fallback in
_build_outbound_payload was downgrading any message containing a
table to plain text, stripping ALL markdown formatting.

Fix:
- Add _TABLE_BLOCK_RE to detect markdown table blocks
- Route table content through post (tag:md) instead of text
- Update docstring to reflect md tag GFM support

Related: #27529, #26658
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery platform/feishu Feishu / Lark adapter P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists labels May 18, 2026
@alt-glitch

Copy link
Copy Markdown

Duplicate of #26108 (same fix: route Feishu markdown table content through post+tag:md instead of force-text). Same files changed, same approach. See consolidation issue #27469 for the full Feishu markdown rendering family.

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 duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feishu] Fix markdown table rendering: use post+tag:md instead of force-text workaround

2 participants