butler54/mdformat-frontmatter

Change in behavior of mdformat-frontmatter output

Closed this issue · 4 comments

We use mdformat to format markdowns. For automation and validation, the markdowns have yaml header with metadata about the document.
We use pre-commit hook to invoke mdformat and mdformat-frontmatter plugin so that the yaml can be ignored.
pre-commit version 2.17.0
mdformat version: 0.7.13

- repo: https://github.com/executablebooks/mdformat
    rev: 0.7.13 # Do not change version. 0.6.0 introduces breaking changes.
    hooks:
    - id: mdformat
      exclude: "CHANGELOG.md|docs/mkdocs_code_of_conduct.md|docs/api_reference"
      additional_dependencies:
      - mdformat-tables
      - mdformat-config
      - mdformat-frontmatter
      - mdformat-gfm

Notice that mdformat-frontmatter is formatting data in the header and inserting new lines.
example changes:

source-location: https://github.com/master/procedures/test-n/test-n.md

to

source-location: 
  https://github.com/master/procedures/test-n/test-n.md

Expected behavior:
The new lines should not be added and yaml header should not be formatted at all.

Sorry for not getting back to you .. I'll have a look in the next few weeks.

Okay i've validated the behaviour as an issue. Will be investigating the 'why'

We use mdformat to format markdowns. For automation and validation, the markdowns have yaml header with metadata about the document. We use pre-commit hook to invoke mdformat and mdformat-frontmatter plugin so that the yaml can be ignored. pre-commit version 2.17.0 mdformat version: 0.7.13

- repo: https://github.com/executablebooks/mdformat
    rev: 0.7.13 # Do not change version. 0.6.0 introduces breaking changes.
    hooks:
    - id: mdformat
      exclude: "CHANGELOG.md|docs/mkdocs_code_of_conduct.md|docs/api_reference"
      additional_dependencies:
      - mdformat-tables
      - mdformat-config
      - mdformat-frontmatter
      - mdformat-gfm

Notice that mdformat-frontmatter is formatting data in the header and inserting new lines. example changes:

source-location: https://github.com/master/procedures/test-n/test-n.md

to

source-location: 
  https://github.com/master/procedures/test-n/test-n.md

Expected behavior: The new lines should not be added and yaml header should not be formatted at all.

This should now be fixed, however, there is still an indent structure enforcement - but the line endings should not be wrapped. @mrgadgil could you test with v2.0.7

I think this is resolved now!