conventional-changelog/conventional-changelog

avoid double empty lines in mainTemplate

andboss opened this issue · 0 comments

I'm using in all projects the adapted mainTemplate to remove the double empty lines to avoid markdownlint MD012 issues, because the CHANGELOG.md is used in docs build (mkdocs toolchain) and should be consistent without exceptions.

E.g. here the double empty line before ### Features and before ### Bug Fixes:

# Changelog

## [1.2.0](htpps://my-gitlab/my-project/v1.1.5...v1.2.0) (2023-12-17)


### Features

* add handling of content update and versioning
* use node:slim as base image


### Bug Fixes

* changelog additional EOL

## [1.1.5](htpps://my-gitlab/my-project/v1.1.4...v1.1.5) (2023-12-5)
...

Would it be possible add it configurable somehow or be the default?

mainTemplate:

{{> header}}
{{#if noteGroups}}
{{#each noteGroups}}

### ⚠ {{title}}

{{#each notes}}
* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}
{{/each}}
{{/each}}
{{/if}}
{{#each commitGroups}}

{{#if title}}
### {{title}}

{{/if}}
{{#each commits}}
{{> commit root=@root}}
{{/each}}
{{/each}}

need always to be configured in a js config:

const mainTemplate = fs.readFileSync('.release-it/main.hbs').toString();
...
module.exports = {
  ...
  plugins: {
    '@release-it/conventional-changelog': {
      infile: "CHANGELOG.md",
      header: "# Changelog",
      preset: "conventionalcommits",
      writerOpts: {
        mainTemplate: mainTemplate
      }
    }
  }