Skip to content

fix(feishu): render Markdown tables natively instead of falling back to plain text (#61643) - #61647

Closed
CAIHEee wants to merge 1 commit into
NousResearch:mainfrom
CAIHEee:fix/feishu-table-render
Closed

fix(feishu): render Markdown tables natively instead of falling back to plain text (#61643)#61647
CAIHEee wants to merge 1 commit into
NousResearch:mainfrom
CAIHEee:fix/feishu-table-render

Conversation

@CAIHEee

@CAIHEee CAIHEee commented Jul 9, 2026

Copy link
Copy Markdown

Fixes #61643.

Summary

The Feishu outbound payload builder was force-routing any message containing a Markdown table to the text message type, based on an outdated assumption that post-type md elements do not render tables.

Verified on Feishu IM (PC + mobile, 2026-07-10) that GFM tables now render natively inside md elements — pipe syntax and separator lines render as proper tables with column alignment (left/right/center via :--- / ---: / :---:).

Changes

  1. _MARKDOWN_HINT_RE — added (^\|.*\|) so messages containing only a Markdown table still route to post. The existing regex had no clause matching |, which meant table-only messages fell through to plain text.
  2. _build_outbound_payload — removed the force-text branch for content matching _MARKDOWN_TABLE_RE. Tables now flow through the standard Markdown rendering path.

Net diff: +9 / −7 lines.

Testing

Stress-tested locally with hermes send --to feishu:

  • 2-column simple table → renders correctly
  • 4-column table with mixed bold + list + table → renders correctly
  • 8-column × 12-row English table → renders with horizontal scroll on mobile (expected)
  • 5-column Chinese table → Unicode preserved, no garbled headers
  • Long cell content → wraps within cell, doesn't break layout
  • Code block containing | → not misidentified as table

Impact

Currently 100% affected: every Feishu message containing a Markdown table displays raw pipe syntax. After this fix, tables render natively.

Environment

  • Hermes: latest main
  • Feishu client: PC + iOS, 2026-07-10
  • Repro: hermes send --to feishu --file <md_with_table.md>

…to plain text (NousResearch#61643)

The Feishu outbound payload builder was force-routing any message containing
a Markdown table to the text message type, based on an outdated assumption
that post-type 'md' elements do not render tables.

Verified on Feishu IM (PC + mobile, 2026-07-10) that GFM tables now render
natively inside md elements. The fix:

- Adds `(^\|.*\|)` to `_MARKDOWN_HINT_RE` so messages containing only
  a table still route to post (the existing regex had no `|` clause).
- Removes the force-text branch in `_build_outbound_payload`; tables now
  flow through the standard markdown rendering path.

Stress tested with 8-column / 12-row tables, Chinese content, and long
cell wrapping — all render correctly on PC and mobile clients.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have platform/feishu Feishu / Lark adapter labels Jul 9, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for tracing the current plain-text downgrade. Current main still returns text for _MARKDOWN_TABLE_RE matches at plugins/platforms/feishu/adapter.py:4524-4534, so the underlying routing problem remains.

Problems

  • The added (^\|.*\|) alternative in _MARKDOWN_HINT_RE is not table-specific: it accepts any line starting and ending with |, without requiring a separator row. It also leaves tables without outer leading pipes unmatched because both it and _MARKDOWN_TABLE_RE require ^|.
  • No regression test covers the changed routing. Existing inline-Markdown coverage at tests/gateway/test_feishu.py:2625-2663 only asserts the post path for bold/italic text.

Suggested changes

  • Route with a table-specific detector alongside _MARKDOWN_HINT_RE, and support both outer-pipe and no-outer-pipe table forms.
  • Add table-only, mixed-content, and non-table pipe-line routing tests.

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 11, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Closing — this was fixed on main by #68121, which removes the _MARKDOWN_TABLE_RE force-text downgrade and routes tables through post/md, the same direction as this PR. Your live verification on PC + mobile (2026-07-10) was one of the three independent confirmations that made removing the workaround safe to ship. The salvage was based on #58019 (cleanest implementation vs current main, with tests) with #29552 credited as the earliest submitter against the live plugin adapter path; both authors' commits were cherry-picked with authorship preserved. Thanks for contributing a fix for this — it was one of the most-reported bugs in the tracker.

@teknium1 teknium1 closed this Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug: Feishu messages show raw Markdown table syntax instead of rendering

3 participants