Skip to content

Conversation

@mneumann
Copy link
Contributor

@mneumann mneumann commented Mar 9, 2025

Fixes #59

mneumann added 2 commits March 9, 2025 10:02
Do a `flat_map_reduce` over the list of children and filter out any
child that is either `[]` or `nil`. The `count` is required to properly
detect the first non-blank item, which shouldn't be prefixed with a
new-line.

As the code is used in both `format` and `format_content`, factor it out
into `format_children`.

Fixes: joshnuss#59
@mneumann mneumann force-pushed the remove-surplus-newlines-59 branch from 42df639 to 9b5ee43 Compare March 9, 2025 09:02
Copy link
Owner

@joshnuss joshnuss left a comment

Choose a reason for hiding this comment

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

Looks great!

Left 2 small comments.

@joshnuss joshnuss merged commit a8a8696 into joshnuss:master Mar 27, 2025
12 checks passed
@joshnuss
Copy link
Owner

Thanks @mneumann!! Much appreciated

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.

Surplus newlines when children contain []

2 participants