feat: resolve markdown blank-line formatting inconsistency in post me…#1216
Conversation
…ssages Change-Id: Ic2870ecbcb31ae7d36121f120102f2ff964f5169
📝 WalkthroughWalkthroughThis PR consolidates markdown-to-Feishu post rendering. Instead of emitting segmented ChangesMarkdown-to-Feishu Post Rendering Consolidation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1216 +/- ##
==========================================
+ Coverage 68.23% 69.19% +0.96%
==========================================
Files 617 633 +16
Lines 57176 59492 +2316
==========================================
+ Hits 39013 41166 +2153
- Misses 14933 15010 +77
- Partials 3230 3316 +86 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@91c17e35239a131f6e84823e8a62e39b716db144🧩 Skill updatenpx skills add 91-enjoy/cli#feat/resolve-markdown-blank-line -y -g |
…ssages (larksuite#1216) Simplifies the markdown-to-post rendering pipeline in the IM shortcut. The previous implementation split markdown at blank-line boundaries into multiple post paragraphs, using zero-width space (\u200B) sentinel characters to preserve visual spacing. While well-intentioned, this approach introduced fragility around edge cases such as blank lines inside fenced code blocks, messages with only blank lines, and interactions with the heading-normalization pass. This change consolidates rendering back into a single {"tag":"md"} segment, making the output more predictable, the code significantly easier to follow, and the test surface easier to maintain. Change-Id: Ic2870ecbcb31ae7d36121f120102f2ff964f5169
Summary
Simplifies the markdown-to-post rendering pipeline in the IM shortcut. The previous
implementation split markdown at blank-line boundaries into multiple post paragraphs,
using zero-width space (
\u200B) sentinel characters to preserve visual spacing.While well-intentioned, this approach introduced fragility around edge cases such as
blank lines inside fenced code blocks, messages with only blank lines, and interactions
with the heading-normalization pass. This change consolidates rendering back into a
single
{"tag":"md"}segment, making the output more predictable, the code significantlyeasier to follow, and the test surface easier to maintain.
Changes
wrapMarkdownAsPostandresolveMarkdownAsPostto produce a single-segmentpost payload directly, without dispatching through a multi-step segmentation pipeline
directly into
optimizeMarkdownStyle, removing the need for standaloneprotectMarkdownCodeBlocks/restoreMarkdownCodeBlockshelpersmarkdownPartstruct,shouldUseSegmentedPost,splitMarkdownByBlankLines,marshalMarkdownPostContent,buildSingleMDPost,buildSegmentedPost,buildMarkdownPostContentreBlankLineSeparatorregex and thepostBlankLinePlaceholder/markdownCodeBlockPlaceholderpackage-level constantsdecodePostContentForTest,decodePostParagraphForTest)and all test cases that covered the removed multi-segment behavior; simplify
the remaining
TestWrapMarkdownAsPostto assert on the raw JSON structureTest Plan
go test ./shortcuts/im/... -racepassesgo build ./...passes with no errorsTestOptimizeMarkdownStyle(heading normalization, table formatting, code-blockprotection, excess-newline compression) remains fully covered and unchanged
lark im message send --markdownflowworks as expected
Related Issues
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests