fix(notion-writer): skip archived blocks when replacing page content

The --replace flag failed with "Can't edit block that is archived" when
a page contained previously archived blocks. Now skips them during clear.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 23:26:42 +09:00
parent 382b55e9c8
commit c9772db119

View File

@@ -349,8 +349,10 @@ def clear_page_content(notion: Client, page_id: str) -> bool:
# Get all child blocks
children = notion.blocks.children.list(block_id=formatted_id)
# Delete each block
# Delete each block (skip already archived blocks)
for block in children.get('results', []):
if block.get('archived'):
continue
notion.blocks.delete(block_id=block['id'])
return True