Parsing does not work on Windows with CRLF line endings
akashvibhute opened this issue · comments
Akash Vibhute commented
The parse contents function only splits the content with \n---\n, so when creating posts on a windows machine which defaults to CRLF, this throws parsing error even if --- separator is available. It works as expected when file is changed to LF.
Should this be updated to support windows line endings? This should only be a problem in development (which can be fixed by updating the files) as most projects using this library will get deployed on Unix. If not, a note in the readme/doc will be helpful.
defp parse_contents(path, contents) do
case :binary.split(contents, "\n---\n") do
[_] ->
{:error, "could not find separator --- in #{inspect(path)}"}
...
end
end