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

Define line break #4

Closed
nichtich opened this issue May 22, 2021 · 2 comments · Fixed by #8
Closed

Define line break #4

nichtich opened this issue May 22, 2021 · 2 comments · Fixed by #8

Comments

@nichtich
Copy link

Which character(s) are considered a line break? LF? Also CRLF? All linebreaks defined by Unicode? I'd not include additional Unciode line breaks such as U+2029 so you can still use them for linebreaks within a block (if you your editor supports entering it instead of a normal line break)

@gordonbrander
Copy link
Collaborator

This is a great call-out, thank you!

My instinct is to define line breaks in terms of Unix and Windows ASCII newline escape sequences, so: \n and \r\n at the end of a line would be treated equivalently as a line break.

Combing through https://en.wikipedia.org/wiki/Newline, I notice JSON and JavaScript treat newlines differently. JSON allows LS and PS in strings, while ECMAScript prior to ES2019 treats them as newlines.

Anyone happen to have links on newline footguns? I'd love to do the most universal thing here, and I want to avoid spec'ing in an edge case that will bite later.

@gordonbrander
Copy link
Collaborator

gordonbrander commented May 24, 2021

Idea from Ade: “Standardise on Unix newlines and follow the Go approach of normalising every file you touch.” https://twitter.com/ade_oshineye/status/1396726639464169474?s=21

Issue discussion from Go decision golang/go#16355

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 a pull request may close this issue.

2 participants