Skip to content

馃悰 Preserve inline child edits when converting syntax trees to tokens - #453

Open
KennyMcSimpson wants to merge 1 commit into
executablebooks:masterfrom
KennyMcSimpson:fix/syntax-tree-token-children
Open

KennyMcSimpson wants to merge 1 commit into
executablebooks:masterfrom
KennyMcSimpson:fix/syntax-tree-token-children

Conversation

@KennyMcSimpson

Copy link
Copy Markdown

SyntaxTreeNode.to_tokens() includes changes to block children but silently drops changes below inline and image nodes. For example, clearing an inline node's children still renders the original paragraph, and clearing image children retains the original alternative text.

Rebuild token child lists from the current tree while keeping the original token objects. Add regression coverage for removal, reordering, nested edits and empty inline replacement, document the synchronization, and add a changelog entry.

Validation: the final regression tests produce 3 failures and 1 passing round-trip control on the original implementation. With this change, the complete Python 3.12 suite passes (1,035 tests), and all pre-commit hooks pass, including Ruff and strict mypy. Tests ran in UTF-8 mode on Windows.

Prepared with OpenAI Codex assistance; no independent human review is claimed.

This branch has not been deployed

No deployments
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