Skip to content

Trim trailing whitespace from prefix in indent#353

Merged
mgeisler merged 1 commit intomasterfrom
indent-trim-trailing-whitespace
May 13, 2021
Merged

Trim trailing whitespace from prefix in indent#353
mgeisler merged 1 commit intomasterfrom
indent-trim-trailing-whitespace

Conversation

@mgeisler
Copy link
Copy Markdown
Owner

Before, empty lines would get no prefix added. Now, empty lines have a trimmed prefix added.

This little trick makes indent much more useful: you can now indent with "# " without fearing creating trailing whitespace in the output due to the trailing whitespace in your prefix.

When you indent with a prefix of pure whitespace, such as " " or similar, you will see no difference. If you indent with a non-whitespace prefix, you will now see it added to every line of your input.

Before, empty lines would get no prefix added. Now, empty lines have a
trimmed prefix added.

This little trick makes `indent` much more useful: you can now indent
with `"# "` without fearing creating trailing whitespace in the output
due to the trailing whitespace in your prefix.

When you indent with a prefix of pure whitespace, such as `" "` or
similar, you will see no difference. If you indent with a
non-whitespace prefix, you will now see it added to every line of your
input.
@mgeisler mgeisler force-pushed the indent-trim-trailing-whitespace branch from ea739af to fb98836 Compare May 13, 2021 11:51
@mgeisler mgeisler enabled auto-merge May 13, 2021 11:53
@mgeisler mgeisler merged commit 7a9a65c into master May 13, 2021
@mgeisler mgeisler deleted the indent-trim-trailing-whitespace branch May 13, 2021 11:54
This was referenced May 30, 2021
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.

1 participant