Skip to content
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

doc.flex_break #1

Merged
merged 31 commits into from
Sep 4, 2023
Merged

doc.flex_break #1

merged 31 commits into from
Sep 4, 2023

Conversation

giacomocavalieri
Copy link
Owner

@giacomocavalieri giacomocavalieri commented Aug 29, 2023

This PR adds flex_break to get flexible layouts that can adapt nicely to the maximum line width:

["1", "2", "3", "4", "5", "6"]
|> list.map(doc.from_string)
|> doc.join(with: doc.flex_break("", ""))
|> doc.group
|> doc.to_string(4)
|> should.equal("1234\n56")

Here the group is no longer split in an "all or nothing" way: only the flex breaks are split when necessary.

This is still a WIP since I need to:

  • add more tests to see that flex breaks actually work
  • add documentation with examples
  • update the CHANGELOG
  • make a new release
  • (optionally) write another tutorial to cover this feature

@giacomocavalieri giacomocavalieri force-pushed the flex_break branch 3 times, most recently from f943451 to 5e6ca0e Compare August 31, 2023 06:02
This was linked to issues Aug 31, 2023
@giacomocavalieri giacomocavalieri added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 31, 2023
@giacomocavalieri
Copy link
Owner Author

This PR is already way bigger than I anticipated so I'm merging it and I'll complete the tutorial in another one :)

@giacomocavalieri giacomocavalieri marked this pull request as ready for review September 4, 2023 20:04
@giacomocavalieri giacomocavalieri merged commit b59304f into main Sep 4, 2023
1 check passed
@giacomocavalieri giacomocavalieri deleted the flex_break branch September 4, 2023 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a useful resources section in the README Add a cute logo
1 participant