Fix indentation of nested elements in preserved mixed content - #1047
Open
Kaiserunix wants to merge 1 commit into
Open
Fix indentation of nested elements in preserved mixed content#1047Kaiserunix wants to merge 1 commit into
Kaiserunix wants to merge 1 commit into
Conversation
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.
Fixes #995.
With
xmlWhitespaceSensitivity: "preserve", an element following a text sibling loses one indentation level inside its body. Wrap the preserved fragments in the existingindentdocument builder, so child documents retain their parent indentation. Literal text whitespace continues to useliterallineand remains unchanged.Add regression coverage for nested mixed content with 2- and 4-space indentation, tabs, formatting stability, inline text whitespace, and
xml:space="preserve"across all whitespace modes. Update only the two affected indentation lines in the existing preserve snapshot.Validation on Windows, Node 25.8.1, Prettier 3.9.6:
npm test -- --runInBand).prettier.formatreproduction passes with unchanged assertions, including strict and element-only controls.npm run lint, formatting checks for the changed files, andgit diff --checkpass.--end-of-line auto. The default full check flags pre-existing Windows CRLF checkout files; their HEAD blobs and LF-normalized contents pass the formatter. Unrelated files were not rewritten.Linux/CI Node 20 was not run locally. This patch and its tests were prepared with AI assistance.