rlnt / vscode-keepachangelog

A VSCode extension that provides snippets for markdown files to create a changelog with the ruleset of Keep a Changelog.
GNU Lesser General Public License v3.0
13 stars 3 forks source link

Generated markdown does not pass lint test #5

Closed rcdailey closed 2 years ago

rcdailey commented 2 years ago

There are some minor formatting issues with the generated markdown. Mainly has to do with insufficient newlines.

Tests were performed with the markdownlint extension installed in VS Code. I also edit my CHANGELOG.md file in VS Code.

Steps to reproduce

  1. Open your MARKDOWN.md file in VS Code.
  2. Put your caret after the [Unreleased] header, as shown in FIGURE1 (at the bottom of this issue).
  3. Type c, then CTRL+SPACE (to auto-complete) and select cl-added. Press ENTER.

The generated markdown (FIGURE2 below) has several markdown lint violations of type MD022/blanks-around-headings/blanks-around-headers:

Headings should be surrounded by blank lines

Expected Output

The markdown (based on FIGURE2) that is expected is below:

## [Unreleased]

### Added

-

### Changed

- Unrecognized or unwanted YAML properties in configuration YAML (`trash.yml`) now result in an
  error. This is to help users more easily identify mistakes.

Specifically:

Supporting Attachments

FIGURE1:

image

FIGURE2:

image

rlnt commented 2 years ago

This extension provides snippets that respect the ruleset of Keep a Changelog and does not take any linter into account. As you can see on their page, they also don't have newlines at the positions you mentioned.

If you scroll down to their QnA and read the Is there a standard changelog format?, you will see that they didn't create it with a special format in mind. This issue is out of scope since the extension does exactly what it is advertised to do.

The only thing I could do is to add an extension option to add newlines around headers but that won't be enabled by default. If that's not an option for you, I'm sorry but I won't change anything else.

rcdailey commented 2 years ago

If they didn't create it with a special format in mind, that means there should be no issue with you altering the whitespace in the template, right?

A setting would be great if that's all you're willing to do. At the end of the day, my changelog is a markdown file like any other. The keep a changelog guidelines are not violated when manipulating whitespace, IMHO. The rationale listed for this markdown rule also makes this somewhat a functional issue as well:

Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse headers that don't have a blank line before, and will parse them as regular text.

Thanks for the quick response!

rcdailey commented 2 years ago

Looking at the code, would it be reasonable to just have the snippets themselves in settings so folks can edit them however they want?

rlnt commented 2 years ago

I am not planning to do that. I'm just not having so much time on my hands right now. If you want to have something like this, feel free to fork the project and compile your own version of it. It's LGPL-licensed and you can create your own extension.

Edit: implemented as default behavior