question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MD025 Error when using front_matter_title and h1

See original GitHub issue

Hi, 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:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
DavidAnsoncommented, Mar 24, 2021

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?

1reaction
DavidAnsoncommented, Mar 24, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Markdownlint Rules
If YAML front matter is present and contains a title property (commonly used with blog posts), this rule treats that as a top...
Read more >
Null-ls - Linter & Formatter - Rocky Linux Documentation
The MD025 rule prevents the interpretation of the title, present in the frontmatter, of generating the H1 double header error.
Read more >
markdownlint - npm
A Node.js style checker and lint tool for Markdown/CommonMark files.. Latest version: 0.26.2, last published: 3 months ago. Start using ...
Read more >
Front matter title not showing in TOC - support - HUGO
When I set title on a document, it uses that as the first H1 in the page, which is fine. I can adopt...
Read more >
Markdownlint - Visual Studio Marketplace
When editing a Markdown file in Code with markdownlint installed, ... Multiple headings with the same content; MD025 single-title/single-h1 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found