-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Windows compatibility fix #583
Conversation
Hi @zenflow what's the current behavior on Windows machines without this fix? |
Deploy preview for docusaurus-preview ready! Built with commit 7477ae7 |
Sorry for the delay.. I can answer this tomorrow probably |
I remember that (on Windows) the markdown header is parsed incorrectly as being empty, and some error is thrown later on because of that. Reminder that it's not simply a matter of using \n line endings because Git on Windows is typically configured to change line endings to /r/n when code comes out and back to /n when it goes back in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zenflow Got it. I did a bit of research and stumbled upon this answer on StackOverflow
Could you patch #628 and see if it works? Using \r?\n
is not a common pattern in code and it's very likely that other developers are unaware of this nuance.
@yangshun I can give it a go tomorrow. But I'm a little confused.. Are the new .gitattributes and .editorconfig files in that PR copied to projects when you do |
Oh hmm I was only fixing it on local development. I think you are right, this needs to be copied upon |
Yeah for sure I'll give it a test and review. I think it will help for local development. But I don't think it's a good idea to copy the files when I've seen the /\r?\n/ pattern used a number of places (Next.js, Pino) without code comments and did not consider that it would be unfamiliar to linux-only developers.. but we can make this more clear I think... what if I extract that regex into a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zenflow I'm gonna merge this first since it's a relatively safe fix. I see many occurrences of .split('\n')
in the code, you might want to have a look and fix them too 😄
Simple fix for simple problem causing errors on Windows machines, where Git by default converts line endings from \n to \r\n when checking out code and back to \r when checking it in.