MD025 Error when using front_matter_title and h1
See original GitHub issueHi, when using title
in a YAML frontmatter (aka metadata block) the first heading h1
throws a linting error for rules MD025
and MD043
. When omitting h1
, the top heading h2
throws error MD043
.
front_matter_title: "^\\s*title\\s*[:=]"
is set for MD025
and for MD041
. Rule MD041
is working fine, as it throws no error. (Just in case: Setting front_matter_title: ""
for MD025
in my .markdownlint.yaml
is not changing anything.)
NB: I have read both the Readme and the Rules.md
doc, and I had a look at known issues.
The expected behavior would be a) to be able to use both a frontmatter title block and a # First Heading
together, or b) to be able to omit the # First Heading
when using title
inside a frontmatter.
As I found no solution to this, it might be a bug in the linter specs – or this (intended?) limitation should at least be (better) described in the docs.
The issue has also been described here: https://github.com/microsoft/vscode-docs-authoring/pull/269
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
OK, it seems we agree this scenario should generate an MD025 error due to two top-level headings: https://dlaa.me/markdownlint/#%25m--- title%3A "Hello world" --- %23 Top level heading
Switching the second of those to a second-level heading generates no errors: https://dlaa.me/markdownlint/#%25m--- title%3A "Hello world" --- %23%23 Second level heading
Is that not what you are seeing?
It sounds like you are describing this scenario in which case it sounds like you are seeing the expected behavior: https://github.com/DavidAnson/markdownlint/blob/main/test/front-matter-title-h1.md
If the YAML front matter includes a title, then the H1 element is redundant - as would be a top-level Markdown heading.
If your scenario is different, please provide example Markdown and explain what you expect.