[GH-ISSUE #328] [MD041] - setting front_matter_title to empty string is not turning off the rule in some cases #2129

Closed
opened 2026-03-07 20:04:51 +03:00 by kerem · 3 comments
Owner

Originally created by @msm1089 on GitHub (Sep 13, 2020).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/328

I am new to using markdownlint (and Jekyll, which is what I am using MD in), so apologies if I have made some simple mistake.

In VS Code, I have installed the recommended extension for markdownlint. I am following the step-by-step guide from the Jekyll site.

I have markdown files like

---
layout: post
author: jill
---
A banana is an edible fruit – botanically a berry – produced by several kinds
of large herbaceous flowering plants in the genus Musa.

In some countries...

The first line is violating MD041. I tried turning off the rule in the config:

{
    "default": true,
    "single-title": {
        "front_matter_title": ""
    },
    "first-line-heading": {
        "front_matter_title": ""
    }
}

This seems to half work; when the file is in focus in the editor window, it shows the MD041 warning. When changing focus to a different file, the warning goes away (most of the time, for certain files it remains once they have been in focus in editor window, until I change the config in any way).

It might be some sort of bug with the extension that is causing warning to toggle depending on whether a file is in focus, but I am not asking that to be addressed here ;)

Could anyone help me out with the correct settings to use when creating markdown for Jekyll sites, where there will often be frontmatter that handles missing titles and headings?

Originally created by @msm1089 on GitHub (Sep 13, 2020). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/328 I am new to using markdownlint (and Jekyll, which is what I am using MD in), so apologies if I have made some simple mistake. In VS Code, I have installed the recommended extension for markdownlint. I am following the [step-by-step guide](https://jekyllrb.com/docs/step-by-step/08-blogging/) from the Jekyll site. I have markdown files like ``` --- layout: post author: jill --- A banana is an edible fruit – botanically a berry – produced by several kinds of large herbaceous flowering plants in the genus Musa. In some countries... ``` The first line is violating MD041. I tried turning off the rule in the config: ``` { "default": true, "single-title": { "front_matter_title": "" }, "first-line-heading": { "front_matter_title": "" } } ``` This seems to half work; when the file is in focus in the editor window, it shows the MD041 warning. When changing focus to a different file, the warning goes away (most of the time, for certain files it remains once they have been in focus in editor window, until I change the config in any way). It might be some sort of bug with the extension that is causing warning to toggle depending on whether a file is in focus, but I am not asking that to be addressed here ;) Could anyone help me out with the correct settings to use when creating markdown for Jekyll sites, where there will often be frontmatter that handles missing titles and headings?
kerem 2026-03-07 20:04:51 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (Sep 13, 2020):

If you want to turn off the rule, you can use: "first-line-heading": false. Please try that instead of passing a RegExp that matches everything.

<!-- gh-comment-id:691702357 --> @DavidAnson commented on GitHub (Sep 13, 2020): If you want to turn off the rule, you can use: `"first-line-heading": false`. Please try that instead of passing a RegExp that matches everything.
Author
Owner

@DavidAnson commented on GitHub (Sep 13, 2020):

Regarding the foreground/background behavior you describe, files are scanned when they are in the foreground and any errors will persist even if the file is moved to the background. However, changing settings resets everything and clears all errors, so immediately after doing that only errors that relate to files in the foreground will be displayed.

<!-- gh-comment-id:691702808 --> @DavidAnson commented on GitHub (Sep 13, 2020): Regarding the foreground/background behavior you describe, files are scanned when they are in the foreground and any errors will persist even if the file is moved to the background. However, changing settings resets everything and clears all errors, so immediately after doing that only errors that relate to files in the foreground will be displayed.
Author
Owner

@msm1089 commented on GitHub (Sep 14, 2020):

Thanks for the quick reply and explaining the behaviour @DavidAnson
Problem resolved!

<!-- gh-comment-id:692157858 --> @msm1089 commented on GitHub (Sep 14, 2020): Thanks for the quick reply and explaining the behaviour @DavidAnson Problem resolved!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#2129
No description provided.