Skip to content

Preserve whitespace for pre/textarea when pretty-printing#432

Merged
rschristian merged 2 commits into
preactjs:mainfrom
nwalters512:pretty-format-preserve-whitespace
Sep 30, 2025
Merged

Preserve whitespace for pre/textarea when pretty-printing#432
rschristian merged 2 commits into
preactjs:mainfrom
nwalters512:pretty-format-preserve-whitespace

Conversation

@nwalters512
Copy link
Copy Markdown
Contributor

<pre> and <textarea> are whitespace-sensitive. When pretty-printing, it's important to not inject extra whitespace when rendering them.

There may be more tags for which whitespace should be preserved; these are the two that I specifically know about.

Disclosure: I wrote the tests by hand and used GPT-5-Codex to help with the implementation.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Sep 30, 2025

🦋 Changeset detected

Latest commit: 96dfd13

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
preact-render-to-string Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Member

@rschristian rschristian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable but I'm a bit worried this might break folks using pretty printing in their test suites and the like. Pretty specific tags & change scenarios though, so perhaps the risk is low

Comment thread package-lock.json
@rschristian rschristian merged commit 69ed337 into preactjs:main Sep 30, 2025
1 check passed
@github-actions github-actions Bot mentioned this pull request Sep 30, 2025
@nwalters512 nwalters512 deleted the pretty-format-preserve-whitespace branch October 1, 2025 01:38
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.

2 participants