ilyatitovich / remark-lint-heading-capitalization

Ensure that your Markdown headings capitalization is correct
MIT License
5 stars 1 forks source link

Frontmatter support #9

Open azat-io opened 6 months ago

azat-io commented 6 months ago

I use Frontmatter in my markdown files.

I have some markdown file with the following content:

---
title: Hello World
description: My test page
date: 04-22-2024
---

Blah-blah-blah.

I am currently getting errors when using Frontmatter:

test.md
2:1-5:4      warning Heading capitalization error. Expected: 'Title: Hello World                                                                                                                                                                heading-capitalization remark-lint
Description: My Test Page
Date: 04-22-2024' found: 'title: Hello World
description: My test page
date: 04-22-2024'

I think your plugin should ignore Frontmatter markup or be able to check only the value (not keys) specified in the settings. Like this:

// .remarkrc
{
  "plugins": {
    "remark-lint-heading-capitalization": ["error", {
      "checkFrontmatterFields": ["title"]
    ]
  }
}
ilyatitovich commented 6 months ago

Yes, I need to think about how best to do it, thanks for the suggestion!