I’m working on a site in Windows, but running Jekyll via WSL, which I understand to be a relatively common setup. For the most part, everything’s worked pretty well. However, as the site source is checked out with autocrlf enabled, it has CRLF (
\r\n) line endings on disk, but Jekyll, running on Unix, is expecting
\n line endings, in particular for the excerpt separator, where it’s looking for two line feeds (
I thought of a Clever™ workaround where I’d set the excerpt separator in
_config.yml to two line breaks, which would end up being two CRLF sequences (
\r\n\r\n) if the repo was checked out on Windows, and two line feeds (
\n\n) if checked out on Unix, but that didn’t work as expected. Looking at the file in
.jekyll-cache that contains
excerpt_separator, it appears that it’s converted the CRLF back to LF (it contains the string
"excerpt_separator"=>"\n\n"), so I end up with the original behaviour.
Other people will likely work on the site on Unix in the future, so explicitly setting the excerpt separator to DOS-style line endings isn’t viable. Using Unix-style line endings everywhere is technically possible, but asking for trouble as so many things try and abstract away the difference, and will likely end up producing mixed endings or otherwise making a mess.
I’m hoping that I’m missing a trick that’ll magically make everything work. After all, regular Jekyll for Windows runs under MSYS2, which IIRC hides DOS-style line endings from most software, so this shouldn’t be a totally novel problem.