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

Perhaps add a refill method #60

Closed
mgeisler opened this issue May 23, 2017 · 0 comments · Fixed by #294
Closed

Perhaps add a refill method #60

mgeisler opened this issue May 23, 2017 · 0 comments · Fixed by #294

Comments

@mgeisler
Copy link
Owner

It could be nice if textwrap supported "refilling" a paragraph. It should take an existing string like this

let help = "This is a long help text.
            It continues on this line
            since nicely-wrapped
            lines look better in the
            source code.

            This is a second paragraph
            in the same string.";

This string contains newlines and extra indentation. Refilling it would mean ignoring the extra newlines and indentation, and then otherwise wrapping it at some width.

Multiple paragraphs should probably be supported in order to make it extra convenient.

mgeisler added a commit that referenced this issue Feb 20, 2021
These small helper functions makes it possible to take already wrapped
text and re-wrap it to a different width. Things like Markdown
unordered lists, quoted emails, and comment blocks can be rewrapped
with the refill function.

Fixes #60.
Fixes #121.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant