Skip to content

✨ Add --unix-newline flag to change newline behavior#209

Merged
kynan merged 8 commits into
kynan:mainfrom
s-weigand:force-lf-eol
Feb 10, 2026
Merged

✨ Add --unix-newline flag to change newline behavior#209
kynan merged 8 commits into
kynan:mainfrom
s-weigand:force-lf-eol

Conversation

@s-weigand

@s-weigand s-weigand commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

First of all, thanks for the awesome tool it helps a lot in reducing noise.
I recently encountered the same pre-commit hook fight, described in #208
This change adds the CLI flag --unix-newline to use the \n default newline, the default is to use OS line ending.

Fixes #208

@kynan kynan left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing this! I think we want to change the flag name and refactor the tests a bit.

Comment thread nbstripout/_nbstripout.py Outdated
Comment thread tests/test_end_to_end.py Outdated
Comment thread nbstripout/_nbstripout.py Outdated
Comment thread tests/test_end_to_end.py Outdated
Comment thread tests/test_end_to_end.py
@kynan

kynan commented Feb 8, 2026

Copy link
Copy Markdown
Owner

@owenlamont @varunsh-xilinx FYI, can you please share your opinion here as this is related to #202 and #208 .

Comment thread nbstripout/_nbstripout.py Outdated
@s-weigand s-weigand changed the title ✨ Add --force-lf-eol flag to normalize lineendings ✨ Add --preserve-newline flag to change newline behavior Feb 8, 2026
Comment thread nbstripout/_nbstripout.py Outdated
Comment thread tests/test_end_to_end.py
@kynan

kynan commented Feb 8, 2026

Copy link
Copy Markdown
Owner

Once we've settled on the flag name, can you also update the README?

s-weigand and others added 7 commits February 8, 2026 18:48
Co-authored-by: Florian Rathgeber <florian.rathgeber@gmail.com>
🧪 Use different files for test with and without flag
👌 Use same newline convention for stdout with textconv
🧪 Add test for stdout with textconv
Co-authored-by: Florian Rathgeber <florian.rathgeber@gmail.com>
@s-weigand s-weigand changed the title ✨ Add --preserve-newline flag to change newline behavior ✨ Add --unix-newline flag to change newline behavior Feb 8, 2026

@kynan kynan left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think this is looking good now. Even though we weren't able to solve what we originally intended it's probably still a useful feature. And given how much time we spent on it not merging now feel like a waste :)

Comment thread nbstripout/_nbstripout.py
@varunsh-xilinx

Copy link
Copy Markdown

@owenlamont @varunsh-xilinx FYI, can you please share your opinion here as this is related to #202 and #208 .

In #202, I assumed that people on Windows would also be checking out with CRLF endings and commit LF endings so using None would work well to preserve the native OS EOL, which I agree is the least surprising outcome. So having a flag to change that behavior looks good to me.

Comment thread nbstripout/_nbstripout.py
Co-authored-by: Florian Rathgeber <florian.rathgeber@gmail.com>
@kynan kynan merged commit 186d22f into kynan:main Feb 10, 2026
15 checks passed
@s-weigand s-weigand deleted the force-lf-eol branch February 11, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nbstripout 0.8.2 can fight with pre-commit-hooks v6.0.0 on Windows over line endings

3 participants