larksuite / larksuite/cli

docs +update truncates multi-block Markdown content, only the first few blocks are persisted

Open
#2,040 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug domain/doc
Dominant language
Go
Stars
17.3k
Forks
1.4k
Avg merge
2d 4h
Merged PRs (30d)
105

Description

Environment
lark-cli version: 1.0.76
OS: Windows 10 / Git Bash
Command: lark-cli docs +update --command append|block_insert_after|str_replace|overwrite
Description
When using docs +update to insert or append Markdown content that contains multiple top-level blocks (e.g., h4, p, h5, ul), only the first few blocks are persisted. The remaining content is silently discarded.

However, docs +create with the same Markdown content correctly preserves all blocks.

Steps to Reproduce
Create a Markdown file test.md:

Test Section

This is an introductory paragraph.

Subsection A
  • List item 1
  • List item 2
Subsection B

Another paragraph.

  • List item 3
  • List item 4
    Append it to an existing document:

lark-cli docs +update
--doc "https://your-domain.feishu.cn/wiki/XXXXXXXX"
--command append
--doc-format markdown
--content @test.md
Fetch the document and inspect the result.
Expected Behavior
All blocks should be appended:

Test Section heading
Introductory paragraph
Subsection A heading
Two list items
Subsection B heading
Another paragraph
Two list items
Actual Behavior
Only the first few blocks are persisted. For example:

Test Section

This is an introductory paragraph.

Subsection A

...

All remaining blocks are silently lost.

Additional Tests
docs +create --content @test.md → works, all blocks preserved.
Splitting content into individual blocks and appending one by one via script → still only ~6 blocks retained.
Tried XML and Markdown formats → same truncation.
Tried block_insert_after, append, str_replace, overwrite → all truncated.
Suspected Cause
docs +update may have an undocumented limit on the number of blocks per --content payload, or a bug in block enumeration when calling the doc v2 update API.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the docs +update command and reproduce the issue using the provided test.md content and each update mode. Compare its behavior with docs +create and trace the doc v2 update API block enumeration; done means every Markdown block is persisted for append, block_insert_after, str_replace, and overwrite.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.