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

prerelease is mishandling Markdown "atx-style" headings #317

Closed brunobord closed 5 years ago

brunobord commented 5 years ago

Context

zest.releaser version: zest.releaser==6.17.0, Python 3.6

Let's consider the following "project", composed of two files. a version.txt:

1.1.0

And a Changelog.md file, with the following content:

# Changelog

## master (unreleased)

Definitely, I want to add more stuff

## 1.1.0 (2019-02-04)

Added more stuff

## 1.0.0 (2019-02-03)

Added stuff

As you can see, it's using the ATX-style headings. Then I'm running the prerelease command.

Current result

diff --git a/Changelog.md b/Changelog.md
index 2c0f124..566313b 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,6 +1,6 @@
 # Changelog

-## master (unreleased)
+2.0.0 (2019-03-15)

 Definitely, I want to add more stuff

diff --git a/version.txt b/version.txt
index 9084fa2..227cea2 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-1.1.0
+2.0.0

The "version" file is correctly patched, but the "level-2" headings in the Changelog disappears and is not a section title anymore.

Expected result

I think that the headings should be preserved, like this:

diff --git a/Changelog.md b/Changelog.md
index 2c0f124..2592c34 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,6 +1,6 @@
 # Changelog

-## master (unreleased)
+## 2.0.0 (2019-03-15)

 Definitely, I want to add more stuff

diff --git a/version.txt b/version.txt
index 9084fa2..227cea2 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-1.1.0
+2.0.0
reinout commented 5 years ago

Originally, the changelog was meant to be restructured text. That is what zest.releaser was made for. Luck has it that markdown supports that header style :-)

reinout commented 5 years ago

... pressing enter too quickly...

ATX headers would mean quite some effort to support and quite some if/else, I am afraid. You could do some experimenting, of course. But I don’t want to increase the complexity of the code too much, to be honest.

brunobord commented 5 years ago

That is what zest.releaser was made for. [..] ATX headers would mean quite some effort to support and quite some if/else, I am afraid.

It's either way:

But I don’t want to increase the complexity of the code too much, to be honest.

Fair enough I'll keep an eye on this issue :o)

reinout commented 5 years ago

TODO for us, also:

Right?

reinout commented 5 years ago

See #321

mauritsvanrees commented 5 years ago

Documentation PR merged.