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

avoid double empty lines in mainTemplate #1188

Closed
andboss opened this issue Dec 17, 2023 · 0 comments · Fixed by #1235 or #1237
Closed

avoid double empty lines in mainTemplate #1188

andboss opened this issue Dec 17, 2023 · 0 comments · Fixed by #1235 or #1237
Assignees
Milestone

Comments

@andboss
Copy link

andboss commented Dec 17, 2023

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
      }
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment