MD041/first-line-h1 complains despite `title` attribute in frontmatter
See original GitHub issueStart of my .md
file:
---
path: "/impressum"
date: "2012-06-21T10:14:00.000+02:00"
title: "Impressum"
---
## Angaben gemäß § 5 TMG
My .markdownlintrc
file:
{
"MD002": { "level": 2 },
"MD041": { "level": 2 },
//"MD041/first-line-h1": { "level": 2 }, <-- Tried that one too
"MD026": { "punctuation": ".,;:" },
}
But still:
markdownlint -c ../../.markdownlintrc src/pages/imprint.md
src/pages/imprint.md: 7: MD041/first-line-h1 First line in file should be a top level header [Context: "## Angaben gemäß § 5 TMG"]
Am I missing sth or is this a bug?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
The Link Title Attribute: What It Is & How To Use It
Curious about whether there is value in optimizing link title attributes? Here's everything you need to know about using it in SEO.
Read more >Frontmatter - Dendron
Frontmatter is a collection of custom attributes at the top of each Markdown file. The beginning and end of this is indicated by...
Read more >Using the HTML title attribute - Updated March 2020 - TPGi
The HTML title attribute is problematic. It is problematic because it is not well supported in some crucial respects, even though it has...
Read more >Front Matter - Hugo
Hugo allows you to add front matter in yaml, toml, or json to your content files. Front matter allows you to keep metadata...
Read more >title - HTML: HyperText Markup Language - MDN Web Docs
The title global attribute contains text representing advisory information related to the element it belongs to.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay, I’ve convinced myself the behavior of
MD041
should change. If a YAMLtitle
property is present, this rule should accept that as the “top level heading” and not warn again no matter what’s in the body of the document. If it behaved that way, your configuration above would do what you want without any changes. If I still feel this way tomorrow, I’ll look at making this change. Thanks for calling this out!The code does respect YAML titles, but there’s a subtlety that’s causing this issue.
First, proof that YAML title is respected - the following does not trigger
MD041
:However, your example reports an issue because the first text of the document is a header. If
MD041
sees a header first, it doesn’t care if a front matter title is present and it reports an issue.I’ll think about whether that might be correct, but it seems wrong to me right now, so I’m calling this a bug and you can assume I will fix it in the next release.
Sorry about that!