Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve whitespace in text surrounded by newlines #816

Merged
merged 5 commits into from
Jul 5, 2023

Conversation

wackbyte
Copy link
Contributor

@wackbyte wackbyte commented Jul 4, 2023

Changes

Closes #815. This issue came about as withastro/astro#7401 reported the previous whitespace-preserving behavior as incorrect, leading to #809. See my comment for why the behavior introduced by that PR is incorrect.

TLDR: revert #809 (& more)

Testing

I added a new test based on #815 and fixed a few problems with old tests.

Docs

Documentation not changed as this is purely a bugfix.

@changeset-bot
Copy link

changeset-bot bot commented Jul 4, 2023

🦋 Changeset detected

Latest commit: 8a3d789

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

This PR includes changesets to release 1 package
Name Type
@astrojs/compiler 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

@wackbyte wackbyte changed the title Spacing Preserve whitespace in text surrounded by newlines Jul 4, 2023
@wackbyte
Copy link
Contributor Author

wackbyte commented Jul 4, 2023

(It would also be possible to drop hasNewline and instead append/prepend only spaces. Note that this would have no effect on the size of the output, but might simplify the logic a little.)

Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

Thanks for the fix and for updating those tests!

Totally agree with your comment about the intended behavior. Sorry for the regression!

@natemoo-re natemoo-re merged commit a35468a into withastro:main Jul 5, 2023
@wackbyte wackbyte deleted the spacing branch July 5, 2023 18:23
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.

🐛 BUG: HTML minification removes whitespace that should not be removed
2 participants