Skip to content

Add newline at EOF for Markdown files #514

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

LucasFA
Copy link
Contributor

@LucasFA LucasFA commented May 8, 2025

Closes #513
POSIX requires text files to end in a line break. This is sometimes assumed by some tools.

There was a mix of compliant and non-compliant markdown files, suggesting there is no tool dependency on non-compliant files.

Useful scripts, credit to this stackoverflow answer

for f in $(
    grep --binary-files without-match --dereference-recursive --files-with-matches '' .
) ; do
    printf '%s: ' "$f"
    if test "$(tail --bytes 1 "$f")" ; then
        printf "does not end with line break\n"
    else
        printf "ends with line break\n"
    fi
done | grep 'does not end with line break'
for f in $( cat list.txt ) ; do
    printf '%s: ' "$f"
    echo "" >> "$f"
done | grep 'does not end with line break'

LucasFA added 2 commits May 8, 2025 15:14
POSIX requires text files to end in a line break. This is sometimes
assumed by some tools.

There was a mix of compliant and non-compliant markdown files,
suggesting there is no tool dependency on non-compliant files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Files not ended in line break / newline
1 participant