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

Enhance --changelog to support nested headings for changelogs following Keep a Changelog format #119

Open
mehanoid opened this issue Nov 29, 2024 · 1 comment

Comments

@mehanoid
Copy link

The --changelog flag is a great feature for updating CHANGELOG.md during version bumps. However, it currently does not handle nested headings, which makes it incompatible with popular changelog formats like Keep a Changelog.

For example, given the following changelog:

## [Unreleased]

### Added

- Very Useful Feature

## [0.0.1] - 2024-11-29

### Added

- Useful Feature

After running bump minor --changelog, the result is:

## [Unreleased]

### Added
## [0.1.0] - 2024-11-29

- Very Useful Feature

## [0.0.1] - 2024-11-29

### Added

- Useful Feature

The new version (0.1.0) is inserted under the nearest heading (### Added) instead of aligning with the heading level of the previous version (##). This disrupts the structure of changelogs that use nested headings for categories (e.g., ### Added, ### Fixed, etc.).

Expected behavior:

The new version should align with the same heading level as the previous version, resulting in:

## [Unreleased]

## [0.1.0] - 2024-11-29

### Added

- Very Useful Feature

## [0.0.1] - 2024-11-29

### Added

- Useful Feature

Proposed solution

Instead of inserting the new version under the closest heading, bump should search for the previous version heading at the same level (## in this example) and insert the new version after it. This would make the --changelog flag more compatible with nested heading formats.

@grosser
Copy link
Collaborator

grosser commented Nov 29, 2024

sounds like a good plan, PR welcome 👍

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

No branches or pull requests

2 participants