Skip to content

fix(feishu): split fenced code blocks into dedicated post rows#12512

Merged
kshitijk4poor merged 3 commits into
NousResearch:mainfrom
kshitijk4poor:fix/feishu-fenced-post-rows-8638
Apr 19, 2026
Merged

fix(feishu): split fenced code blocks into dedicated post rows#12512
kshitijk4poor merged 3 commits into
NousResearch:mainfrom
kshitijk4poor:fix/feishu-fenced-post-rows-8638

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Summary

  • cherry-pick the core Feishu fenced-code-block row-splitting fix from fix(feishu): split fenced code blocks in post payload #8638 by @sgaofen with authorship preserved
  • harden fence handling so fence-like lines inside a code block are not misparsed as closing fences
  • preserve trailing spaces inside fenced code blocks and add regression coverage for both edge cases

Why

Feishu post/md rendering can swallow trailing content when a fenced code block is embedded in one large markdown element. Splitting fenced blocks into their own post rows preserves normal markdown while keeping the code block visible.

This salvage keeps the original contributor change, then adds a small follow-up commit to address parser edge cases found during review.

Original PR

Follow-up fixes in this salvage

  • use real fence-line detection instead of treating any line starting with ``` as a fence
  • preserve trailing spaces inside fenced code blocks
  • add regression tests for fence-like code lines and trailing-space preservation

Test plan

  • python3 -m py_compile gateway/platforms/feishu.py tests/gateway/test_feishu.py
  • source /Users/kshitij/.hermes/hermes-agent/venv/bin/activate && /Users/kshitij/.hermes/hermes-agent/scripts/run_tests.sh tests/gateway/test_feishu.py -q
  • direct payload smoke check for a fence-like code line inside a fenced block

Attribution note

@kshitijk4poor kshitijk4poor merged commit 957ca79 into NousResearch:main Apr 19, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants