Skip to content

docs: Cleanup whitespace. #133

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 1 commit into
base: main
Choose a base branch
from

Conversation

seanbright
Copy link
Contributor

@seanbright seanbright commented Apr 14, 2025

This patch:

  • Trims lines containing only whitespace
  • Squeezes multiple blank lines in to one
  • Removes all trailing blank lines

@seanbright seanbright force-pushed the sanitize-whitespace branch from 606bac4 to 4a71b8f Compare April 14, 2025 14:52
@seanbright
Copy link
Contributor Author

seanbright commented Apr 14, 2025

Essentially:

# Trim lines containing only whitespace
find . -name '*.md' -exec sed -i -r 's/^\s+$//' '{}' \;

# Squeeze blank lines
find . -name '*.md' -exec sed -i '/\S/,/^\s*$/!d' '{}' \;

# Remove trailing blank lines
find . -name '*.md' -exec sed -i ':a;/^[ \n]*$/{$d;N;ba}' '{}' \;

@gtjoseph
Copy link
Member

@seanbright In markdown, two or more whitespace characters at the end of a line forces a line break. You may have to scan the changes manually to see if any were intentional or not. If you think a line break is warranted, you may want to replace the trailing spaces with <br>.

@seanbright
Copy link
Contributor Author

two or more whitespace characters at the end of a line forces a line break

Gross. I'll just remove the trimming part then.

@seanbright seanbright force-pushed the sanitize-whitespace branch 2 times, most recently from 78bc3c5 to 3502d43 Compare April 14, 2025 15:36
This patch:

* Trims lines containing only whitespace
* Squeezes multiple blank lines in to one
* Removes all trailing blank lines
@seanbright seanbright force-pushed the sanitize-whitespace branch from 3502d43 to 843fce1 Compare April 14, 2025 16:14
@seanbright seanbright marked this pull request as draft April 14, 2025 16:50
@seanbright seanbright marked this pull request as ready for review April 14, 2025 20:15
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.

3 participants