withastro / compiler

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

Compiler does not handle unusual line terminator #872

Closed DanielTate closed 11 months ago

DanielTate commented 1 year ago

Astro Info


 <-- this char is an unusual line terminator when pasting in stackblitz we get a warning but if we don't use an editor that detects this our astro app crashes.

Go to this document https://www.figma.com/file/TyJtpYWrQE7PecTHzuRIaA/Astro.js-bug?type=design&node-id=0%3A1&mode=design&t=MZ9J3mWPSnaMCwVE-1

Right click the text and (copy as text)

Paste into your astro project and save.

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug


 <-- this char is an unusual line terminator when pasting in stackblitz we get a warning but if we don't use an editor that detects this our astro app crashes.

Go to this document https://www.figma.com/file/TyJtpYWrQE7PecTHzuRIaA/Astro.js-bug?type=design&node-id=0%3A1&mode=design&t=MZ9J3mWPSnaMCwVE-1

Right click the text and (copy as text)

Paste into your astro project and save.

What's the expected result?

Give a better warning or handle the line terminator in a more graceful way.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-baxezw?file=src%2Fpages%2Findex.astro

https://www.fileformat.info/info/unicode/char/2028/index.htm

DanielTate commented 1 year ago

It looks like one of these characters: https://dev.to/lpellis/what-are-those-lsep-characters-on-certain-pages-13b8

Princesseuh commented 1 year ago

This is somewhat related to https://github.com/withastro/compiler/issues/785, although that one affected a different part of the compiler