Missing Newline at End of File
cli
An input file does not end with a newline; one is added automatically.
Q-7-1 — Missing Newline at End of File
An input file does not end with a newline; one is added automatically.
What this means
POSIX text files end with a newline. Most editors enforce this, some tools rely on it, and several parsers behave subtly differently when it is missing. Quarto’s input handling tolerates the omission — it adds a newline to the in-memory buffer before parsing — but emits a warning so the discrepancy is visible.
The render still succeeds, and the file on disk is not modified.
Why this happens
Common causes:
- An editor that does not enforce a trailing newline (some Windows editors, older versions of Notepad).
- A file generated by a script that wrote content without
the final
\n. - A file truncated mid-line — investigate this case separately, since a truncation might mean missing content.
How to fix
Add a newline at the end of the file. Most editors offer a
setting to enforce this for new and edited files. A one-shot fix
from the shell is printf '\n' >> file.qmd.