mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 09:16:02 +03:00
[GH-ISSUE #116] MD041/first-line-h1 complains despite title attribute in frontmatter #1946
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#1946
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @stephanschubert on GitHub (Mar 24, 2018).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/116
Start of my
.mdfile:My
.markdownlintrcfile:But still:
Am I missing sth or is this a bug?
@DavidAnson commented on GitHub (Mar 24, 2018):
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
MD041sees 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!
@stephanschubert commented on GitHub (Mar 25, 2018):
@DavidAnson Ah I see—thanks for taking the time to fix it 👍
@amimas commented on GitHub (Mar 9, 2019):
Is this released in version 0.12.0? I'm still seeing this issue. I'm using version 0.14.0 of markdownlint-cli, where I believe version 0.12.0 is included.
https://github.com/igorshubovych/markdownlint-cli/releases/tag/v0.14.0
I also have similar format/content as the original post but I'm getting error reporting that H1 heading is missing.
@DavidAnson commented on GitHub (Mar 9, 2019):
Yes, this fix should be present in recent releases. Can you please show an example of this not working as you expect?
@amimas commented on GitHub (Mar 9, 2019):
Here's the the snippet of the first few lines of a file that is being flagged:
And here's my complete
.markdownlint.jsonfile:When I run markdownlint-cli, I get an error like this:
Also, I realized that not all of my files are being flagged although they all have same frontmatter and similar structure.
@DavidAnson commented on GitHub (Mar 9, 2019):
You're not customizing
MD041as you do in #169, so it is enabled with its default behavior of looking for an H1 heading. Unfortunately, the description of the rule is confusing - or maybe the behavior is confusing.MD041respects the YAMLtitleproperty and won't warn if an H1 is missing buttitleis present. BUT if you start the document with a different heading than what it's configured with (defaultlevel1), then it will complain again. Right now, this feels weird to me, so I'll think more about it. But for your purposes, if you configureMD041as you do in #169, I think you'll get the behavior you want:PS -
numberis not a valid parameter forMD009.@DavidAnson commented on GitHub (Mar 9, 2019):
Okay, I've convinced myself the behavior of
MD041should change. If a YAMLtitleproperty 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!@amimas commented on GitHub (Mar 9, 2019):
Thanks so much for the note. I'll take a look at the doc again.