withastro / compiler

The Astro compiler. Written in Go. Distributed as WASM.
Other
503 stars 59 forks source link

Preserve whitespace in text surrounded by newlines #816

Closed wackbyte closed 1 year ago

wackbyte commented 1 year ago

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[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: 8a3d7899ebad779071eacf2130d70b7bdf89adff

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 commented 1 year ago

(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.)