zestsoftware / zest.releaser

Python software releasing made easy and repeatable
https://zestreleaser.readthedocs.io
GNU General Public License v2.0
198 stars 62 forks source link

Unexpected `prerelease` behaviour with Changelog containing markdown links #369

Closed TSNoble closed 1 year ago

TSNoble commented 3 years ago

I'm having some issues running prerelease with a Changelog that looks like the following:

Changelog
===
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

0.0.1 (unreleased)
-------------------

- foo.

Expected Outcome:

Changelog
===
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

0.0.1 (2021-04-10)
-------------------

- foo.

Actual Outcome:

Changelog
===
0.0.1 (2021-04-10)

0.0.1 (unreleased)
-------------------

- foo.

Additional notes:

Removing the links fixes the issue. I suspect it may be due to the fact that they use parentheses, which I think zest uses to determine which line needs updating. Perhaps the logic could be updated to specifically look for "(unreleased)"? Happy to raise a PR if the change sounds sensible

mauritsvanrees commented 3 years ago

Confirmed. I tried adding an extra line of white space, and fixing the underlines to have the same length as their headers, but that did not help. Putting the notes above the Changelog header did not help either.

Specifically looking for "(unreleased)" may help for prerelease, but in postrelease we would expect to only find a date. So that way to fix it seems hard.

In general, I think we do not handle MarkDown changelogs well, especially not the hashes for headers. I tried with this (copied and adapted from https://keepachangelog.com/en/1.0.0/, which I did not yet know, but I like it):

# Changelog

## [1.1.0] - unreleased
### Added
- A test.

## [1.0.0] - 2017-06-20
### Added
- Blah

prerelease turned this into:

# Changelog

1.1.0 (2021-05-04)
### Added
- A test.

## [1.0.0] - 2017-06-20
### Added
- Blah

So the hashes in front of 1.1.0 are lost. (Note: we always put the date in brackets, we do not try to adapt to the existing style, here with a dash, as we probably thought that too complicated.)

So a PR would probably need to do be a bigger change for supporting MarkDown in general. Preferably without a hard dependency on a package for reading MarkDown.

If you can figure out a smaller change, that would be fine too. But it would need to work for both prerelease and postrelease to be consistent.

mauritsvanrees commented 1 year ago

MarkDown support was added today in PR #398. Released in zest.releaser = 7.2.0.