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

Windows: CRLF line endings cause "Invalid frontmatter format" build error #99

Open
bit-png opened this issue Oct 30, 2024 · 6 comments
Open
Assignees
Labels

Comments

@bit-png
Copy link

bit-png commented Oct 30, 2024

I followed the instructions to install Marmite and start making a blog on Windows. When serving this project with marmite --serve --watch myblog site in Windows, and editing a file in Visual Studio using its default line endings:

---
date: 2024-10-25
tags: hello,world
---

# Hello World
...

The following error appears:

INFO  marmite::site] Change detected. Rebuilding site...
ERROR marmite::site] Failed to process file myblog\hello-world.md: Invalid frontmatter format
INFO  marmite::site] Generated site\index.html

(All my test files used CRLF line endings, but the error only affected the ones with metadata.)

I can fix this within VS Code by switching the file's line endings from CR+LF to just LF, but this issue might need a fix or a note in the documentation for Windows users.

@rochacbruno
Copy link
Owner

thanks for reporting, I don't have windows to test it, let's wait for a PR

@rochacbruno rochacbruno added bug Something isn't working HIGH windows help wanted Extra attention is needed labels Oct 30, 2024
@rochacbruno
Copy link
Owner

It looks like the problem is with serving + watching.

Can you try building without those options?

marmite myblog site

Does that render the site correctly?

You can open the site directly in the browser to test.

@bit-png
Copy link
Author

bit-png commented Oct 30, 2024

Even when just compiling the site (using marmite blog static) it still causes the error message. Here's the full output:

C:\blog>marmite blog site
[2024-10-30T20:32:19Z INFO  marmite::site] Config loaded from: defaults
[2024-10-30T20:32:19Z ERROR marmite::site] Failed to process file blog\hello-world.md: Invalid frontmatter format
[2024-10-30T20:32:19Z INFO  marmite::site] Generated site\404.html
[2024-10-30T20:32:19Z INFO  marmite::site] Generated site\tags.html
[2024-10-30T20:32:19Z INFO  marmite::embedded] Generated site\static\Atkinson-Hyperlegible-Regular-102.woff
[2024-10-30T20:32:19Z INFO  marmite::embedded] Generated site\static\custom.css
[2024-10-30T20:32:19Z INFO  marmite::embedded] Generated site\static\custom.js
[2024-10-30T20:32:19Z INFO  marmite::embedded] Generated site\static\favicon.ico
[2024-10-30T20:32:19Z INFO  marmite::embedded] Generated site\static\github-dark.min.css
[2024-10-30T20:32:19Z INFO  marmite::embedded] Generated site\static\github-light.min.css
[2024-10-30T20:32:19Z INFO  marmite::embedded] Generated site\static\highlight.min.js
[2024-10-30T20:32:19Z INFO  marmite::embedded] Generated site\static\marmite.css
[2024-10-30T20:32:19Z INFO  marmite::embedded] Generated site\static\marmite.js
[2024-10-30T20:32:19Z INFO  marmite::embedded] Generated site\static\pico.min.css
[2024-10-30T20:32:19Z INFO  marmite::embedded] Generated site\static\robots.txt
[2024-10-30T20:32:19Z ERROR marmite::site] Failed to copy site\static\custom.css: The process cannot access the file because it is being used by another process. (os error 32)
[2024-10-30T20:32:19Z ERROR marmite::site] Failed to copy site\static\custom.js: The process cannot access the file because it is being used by another process. (os error 32)
[2024-10-30T20:32:19Z INFO  marmite::site] Copied site\static\favicon.ico to site\favicon.ico
[2024-10-30T20:32:19Z INFO  marmite::site] Copied site\static\robots.txt to site\robots.txt
[2024-10-30T20:32:19Z INFO  marmite::site] Site generated at: site/

(The custom.css/js errors can be ignored, as I've tested a slightly bigger blog with them and they seem to work fine.)

I think the error is from a library -- I see it coming from \frontmatter-gen-0.0.2\src\error.rs and \extractor.rs, because the latter searches for "---\n" when looking for data, and there is no such line ending on Windows-made files.

@rochacbruno
Copy link
Owner

PR opened sebastienrousseau/frontmatter-gen#1

@scovl
Copy link
Contributor

scovl commented Nov 4, 2024

Oh, I went to test this case, but it look like the issue is with the frontmatter-gen library....So, is this problem fixed? @rochacbruno

@rochacbruno
Copy link
Owner

@scovl my PR is merged on sebastienrousseau/frontmatter-gen#1 now it is pending a new release of that crate.

@rochacbruno rochacbruno added release pending and removed help wanted Extra attention is needed labels Nov 4, 2024
@rochacbruno rochacbruno self-assigned this Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants