Open
Conversation
导入侧:convertListItem 的 TaskCheckBox 分支未收集嵌套子列表, extractTextElementsSkipCheckbox 未跳过 ast.List 导致子列表文本渗入父项。 导出侧:BlockTypeTodo 未加入子块收集逻辑,convertTodo 不支持缩进递归。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Background
convertListItem中 TaskCheckBox 分支直接返回&BlockNode{Block: block},未收集 ListItem 下嵌套的子列表;导出侧BlockTypeTodo未加入子块收集逻辑,convertTodo不支持缩进递归。输入 Markdown:
修复前导入:子任务丢失,只有父任务;导出时子任务变成独立顶层块。
修复后:子任务作为 Children 正确嵌套,导出时正确缩进。
Changes
internal/converter/markdown_to_block.gocollectNestedChildren收集嵌套子列表(正确传递 error);extractTextElementsSkipCheckbox跳过ast.List防止子列表文本渗入父项internal/converter/block_to_markdown.goBlockTypeTodo加入子块收集逻辑(与 Bullet/Ordered 一致);新增convertTodoWithDepth支持缩进递归处理嵌套子项internal/converter/todo_nesting_test.goTest Plan
常规检查
go build ./...编译通过go vet ./...静态检查通过go clean -testcache && go test ./...全部测试通过新增用例
TestTodoNestedChildren_ImportTestTodoNestedChildren_ExportTestTodoNestedChildren_Roundtrip真实文档验证
使用以下 Markdown 进行真实飞书文档导入/导出验证:
验证步骤:
go run . doc import /tmp/todo_test.md --title "Todo 嵌套测试" --verbose导入go run . doc blocks <doc_id> --all --output json检查云端块结构,确认:go run . doc export <doc_id>导出,确认嵌套缩进和勾选状态与原始 Markdown 一致验证结果:3 项全部通过。