ionide / KeepAChangelog

Parser and MSBuild Targets for using Keep-A-Changelog-formatted Changelogs in your Build
MIT License
30 stars 4 forks source link

Allow subsections and section less items #22

Closed nojaf closed 10 months ago

nojaf commented 10 months ago

WHAT

๐Ÿค–[deprecated] Generated by Copilot at 4a1d224

Added support for more flexible changelog formats. The Section type now has a SubSections property and can be empty. The Parser and ToMarkdown functions can handle changelogs with sub-sections and section-less entries. The tests were updated accordingly.

๐Ÿค–[deprecated] Generated by Copilot at 4a1d224

Changelog gets richer Section and Parser change Autumn of refactor

๐ŸŽ๐Ÿ› ๏ธ๐Ÿงช

WHY

HOW

๐Ÿค–[deprecated] Generated by Copilot at 4a1d224

Oh hey @baronfel! This is an attempt to make KAC work for the Fable changelogs. They didn't fully play ball and have subsections or items without sections. This PR aims to support those as well.

nojaf commented 10 months ago

Tests do run on my Windows. Feels like a new line failure thing.

baronfel commented 10 months ago

The code looks good! If you can get it green I'd be happy to merge and re-release!

MangelMaxime commented 10 months ago

I believe there is another direction possible to support Fable changelog and any changelog like the one from Nacara that are really detailed. https://github.com/ionide/KeepAChangelog/issues/16

That direction is to consider Changelog as a header specification on top of Markdown. What I mean by that is that Changelog specs is to structure the header of the file which consist in:

Example:

# Changelog

All notable changes to this project will be documented in this file.

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).

## Unreleased

## 2.0.0 - 2023-12-04

### Added

<!-- Markdown body -->

### Changed

<!-- Markdown body -->

## 1.0.0 - 2023-12-03

### Added

<!-- Markdown body  -->

The markdown body can be somehing as simple as:

* Item 1
* Item 2

or complex like:

#### JavaScript

* Item 1
* Item 2

#### All
* Layout system has been added

    User can add `layouts` node to `nacara.js`, it takes an object.

    Example:

    ```js
    {
        default: standard.Default,
        changelog: standard.Changelog
    }

The idea is that this will simplify the parser a lot because it will not depends on a specific structure. 

Domains would looks like:

```fs
type ChangelogData =
    { 
        Added: string
        Changed: string
        Deprecated: string
        Removed: string 
        Fixed: string
        Security: string
        Custom: Map<string, string>
    }

type Release =
    {
        Version: SemanticVersion 
        Date: DateTime
        Categories: ChangelogData option
    }

type Changelog =
    {
        Title: string // option
        Description: string option
        Unreleased: ChangelogData option
        Releases: ChangelogData option
    }
nojaf commented 10 months ago

Yeah maybe, it looks like

https://github.com/ionide/KeepAChangelog/blob/e30765afb22ca1e4d34d848988958bab2c5f06d3/src/Ionide.KeepAChangelog.Tasks/Library.fs#L23-L32

is just combining items again as string.

baronfel commented 10 months ago

RE: @MangelMaxime's comments, I think that's a good direction to go for this library. The KAC 'spec' (such as it is) mentions no structure to the sections, just that there are sections. On the initial version of Ionide.KAC I probably over-corrected because the examples on the KAC website are mostly lists.

nojaf commented 10 months ago

@baronfel this is ready. It can now parse all Fable changelog files.