twisted / towncrier

Manage the release notes for your project.
https://towncrier.readthedocs.io
MIT License
790 stars 122 forks source link

Wrap output changelog at specified line width #464

Open ItsDrike opened 1 year ago

ItsDrike commented 1 year ago

Is there some way to add support for line wrapping of the output changelog file?

I'd like my output changelog to have a maximum line length of 120 characters, however while my individual fragments are wrapped at 120 chars, the generated changelog also contains links to issues, which means the actual line ends up being much longer.

I suppose that this might be doable with the changelog template file, but I'm not sure how would I do this, any suggestions?

Note that I'm aware that there will need to be a way to distinguish between intentional newlines, and newlines due to some line width wrapping in the fragments. This might be pretty difficult, and so instead, what could be done is just expect the fragments to not be line wrapped at all, so any newlines are treated as intentional, and then wrap the lines at some specified line length.

This way the final changelog will be properly formatted with correct line wrapping, and even though the change fragments won't be able to include wrapping, that's usually not that big of an issue in comparison to not having the actual output changelog wrapped.

Ideally, I'd love to see a config option for this making it very easy to handle line wrapping, but I'm not sure how doable this is, as the template file is user-controlled so the resulting output may have some intentional longer lines etc.

SmileyChris commented 6 months ago

We have a wrap configuration option that's boolean. It defaults to false but when true, wraps to 79.

It'd be great if this also accepted an integer and wrapped to that number.

adiroiban commented 6 months ago

wrap was added in 18.6.0 ... issue https://github.com/twisted/towncrier/issues/80

but I can't easily find the PR... and it was a breaking change as the defaut behaviour in 18.5.0 was to wrap by default.


+1 to have this an integer . Happy to review a PR that implements this.