Skip to content

fix: preserve fenced code blocks inside list items#70

Open
sandbarTrue wants to merge 1 commit intoriba2534:mainfrom
sandbarTrue:fix/list-item-code-block
Open

fix: preserve fenced code blocks inside list items#70
sandbarTrue wants to merge 1 commit intoriba2534:mainfrom
sandbarTrue:fix/list-item-code-block

Conversation

@sandbarTrue
Copy link
Copy Markdown

Summary

  • Fenced code blocks nested inside list items were silently dropped during doc import
  • Root cause: convertListItem only collected *ast.List children, ignoring *ast.FencedCodeBlock
  • Added handling for FencedCodeBlock in the child collection loop

Reproduction

- **消息**

这段内容会丢失

Before this fix, the code block content is dropped. After the fix, it is preserved as a child code block of the list item.

Test plan

  • Added TestConvert_ListItemWithCodeBlock test case
  • All existing converter tests pass (go test ./internal/converter/)
  • Verified end-to-end: feishu-cli doc import + doc export roundtrip preserves the content

🤖 Generated with Claude Code

Code blocks nested inside list items (indented fenced code blocks) were
silently dropped during markdown-to-block conversion. The convertListItem
function only collected nested *ast.List children, ignoring
*ast.FencedCodeBlock nodes.

Added handling for FencedCodeBlock in the child collection loop so they
are converted and included as children of the list item block.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant