markdownlint icon indicating copy to clipboard operation
markdownlint copied to clipboard

Frontmatter interpreted as top-level heading

Open garysassano opened this issue 9 months ago • 8 comments

When using a frontmatter, I get the following warning:

image

garysassano avatar May 15 '24 11:05 garysassano

That scenario is correct and documented: https://github.com/DavidAnson/markdownlint/blob/main/doc/md025.md

DavidAnson avatar May 15 '24 16:05 DavidAnson

I see. Yet I don't understand what's the rationale behind this choice, and what's the recommended change when you want to have the h1 header and the page title to be the same.

garysassano avatar May 15 '24 17:05 garysassano

Some systems (Jekyll, perhaps?) automatically use the front matter title as the H1 for the rendered page. In that scenario, what you show here would result in a duplicate title at the top of the blog. If that's not relevant for your situation, it's probably best to disable this rule at a project level.

DavidAnson avatar May 15 '24 18:05 DavidAnson

How can you disable it at the project level? I'm using Astro btw.

garysassano avatar May 15 '24 20:05 garysassano

I don't know anything about how Astro works, but the typical way to do this would be to put a .markdownlint.json file in the root of the project. It only needs to disable the relevant rule by giving it the value false, but here is a complete example of what that file could contain: https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.jsonc

DavidAnson avatar May 15 '24 21:05 DavidAnson