Windows and Mac syncing broken because of newline characters

I use git to manage sync between a mac and windows machine for my personal vault. However, let’s say I write a note on Mac as follow:

FIRSTLINE<CR><LF>
SECONDLINE

Note that macs treat newline as a carriage return followed by a line feed control character. As soon as you open this note on a windows machine in obsidian, it strips out the CR

FIRSTLINE<LF>
SECONDLINE

Which means that the note auto-sorts to the top of my explorer pane since Obsidian has modified the MD file and additionally git thinks I’ve modified and need to push that file. Obsidian modifies any file as soon as you click it with newline changes.

Most IDEs handle LF/CR relatively gracefully, and will use whatever is in the file without modifying them. Is this a bug, or should it be changed in Obsidian?

2 Likes

Okay, scratch that. I reset from the origin/main on github and now Obsidian is not converting the LF endings to CRLF.

For anyone else that possibly runs into this issue, make sure you disable autocrlf using:

git config core.autocrlf false
1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.