lambda-packages icon indicating copy to clipboard operation
lambda-packages copied to clipboard

🐛 BUG: Astro components insert a space after text because POSIX incompatibility

Open felixsanz opened this issue 3 years ago • 2 comments

What version of astro are you using?

v1.0.0-beta.42

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Linux

Describe the Bug

If a component contains this text:

<>foo</>(\n, new line)
(EOF, empty line)

1655469540

And the component is then called like <p><Foo /></p>, the result is <p>foo </p> (with a space after foo).

POSIX define a line as:

3.206 Line A sequence of zero or more non- < newline > characters plus a terminating < newline > character.

But here the terminating new line char is converted to a space, and shouldn't because it alters the HTML.

1655469715

1655469722

Link to Minimal Reproducible Example

https://codesandbox.io/s/quiet-tdd-ys9mu6?file=/src/pages/index.astro

Participation

  • [ ] I am willing to submit a pull request for this issue.

felixsanz avatar Jun 17 '22 12:06 felixsanz

Just a thought... a solution could involve using trim() ?

felixsanz avatar Jun 17 '22 12:06 felixsanz

I'm not sure if this would actually be in core or in our compiler, @natemoo-re does this one jump out to you as a likely compiler fix?

tony-sull avatar Jun 20 '22 15:06 tony-sull