towncrier icon indicating copy to clipboard operation
towncrier copied to clipboard

Strip leading and trailing space per line (maybe?)

Open altendky opened this issue 4 years ago • 1 comments

https://github.com/twisted/towncrier/pull/311

The leading spaces resulted in some odd formatting as the first line got it's leading space stripped and the second and third did not. On the one hand, this was presumably not intended here. On the other, making it impossible to create that result means you can't... achieve that result. Maybe strip leading and trailing whitespace from each line? Maybe do a textwrap.dedent instead? Or maybe it isn't that big a deal and you should just look at your resulting newsfile...

In my other projects this would have (theoretically) been caught in the initial PR that added the newsfragment as the readthedocs PR build would have run towncrier and we would have checked the formatting in the result as part of review.

So, this is documented but I'm not certain either way that this behavior should or should not be changed.

altendky avatar Jan 09 '21 16:01 altendky

My understanding is that the content of each news-fragment is exactly one release note item.

From inside the news-fragment file you don't control where that list item is presented on the page,

My understanding is that towncrier should perform the following operations:

  • strip (leading/trailing) each line from the file.
  • merge all lines from the news-fragment file into a single line replacing newlines with space character
  • reformat the line / re-rewrap to match the final file format.

Make sense?

adiroiban avatar Jan 09 '21 17:01 adiroiban