[GH-ISSUE #270] Error MD022 rule trigged when frontmatter is in JSON format #2078

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

Originally created by @andreamussap on GitHub (Apr 1, 2020).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/270

In Axway open documentation project we use VScode with DavidAnson/ markdownlint plugin. Each of our pages starts with a frontmatter/heading either in YAML or JSON format.

Issue

We've notice that when the frontmatter is in JSON format, the plugin triggers the MD022 rule, which shows a markdown error. This creates a lot of work for the writes who have to edit the page just to add one line between the JSON frontmatter and the heading, and create a new commit in the pull request.

Everything works fine though when the frontmatter is in YAML format.

Hence, I'd like to ask you if you can make the MD022 rule work for JSON frontmatter, that is, do not show a markdown error when there's no blank line between the frontmatter and the heading.

Thanks, Andrea.

Originally created by @andreamussap on GitHub (Apr 1, 2020). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/270 In [Axway open documentation](https://github.com/Axway/axway-open-docs) project we use VScode with DavidAnson/ markdownlint plugin. Each of our pages starts with a frontmatter/heading either in YAML or JSON format. ## Issue We've notice that when the frontmatter is in **JSON** format, the plugin triggers the [MD022 rule](https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md022---headings-should-be-surrounded-by-blank-lines), which shows a markdown error. This creates a lot of work for the writes who have to edit the page just to add one line between the JSON frontmatter and the heading, and create a new commit in the pull request. Everything works fine though when the frontmatter is in YAML format. Hence, I'd like to ask you if you can make the MD022 rule work for JSON frontmatter, that is, do not show a markdown error when there's no blank line between the frontmatter and the heading. Thanks, Andrea.
kerem 2026-03-07 20:04:19 +03:00
Author
Owner

@DavidAnson commented on GitHub (Apr 1, 2020):

If you were using the library directly, you could configure this yourself: https://github.com/DavidAnson/markdownlint/blob/master/README.md#optionsfrontmatter

However, I don’t think that configuration is exposed through either the CLI or VS Code extension.

I need to think about whether to add support for JSON front matter to the library by default, or expose this setting through the tools, or perhaps expose the settings object through the tools.

<!-- gh-comment-id:607321340 --> @DavidAnson commented on GitHub (Apr 1, 2020): If you were using the library directly, you could configure this yourself: https://github.com/DavidAnson/markdownlint/blob/master/README.md#optionsfrontmatter However, I don’t think that configuration is exposed through either the CLI or VS Code extension. I need to think about whether to add support for JSON front matter to the library by default, or expose this setting through the tools, or perhaps expose the settings object through the tools.
Author
Owner

@andreamussap commented on GitHub (Apr 21, 2020):

Hi @DavidAnson just to rectify the information in the description of the ticket:

we use DavidAnson/ markdownlint plugin via the markdownlint-cli and VS Code, so we don't have direct access to your library.

So, I'm looking forward to the implementation of this enhancement, it's going to be of great help in my project.
Thanks,
/Andrea

<!-- gh-comment-id:617092582 --> @andreamussap commented on GitHub (Apr 21, 2020): Hi @DavidAnson just to rectify the information in the description of the ticket: > we use DavidAnson/ markdownlint plugin via the [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli) and VS Code, so we don't have direct access to your library. So, I'm looking forward to the implementation of this enhancement, it's going to be of great help in my project. Thanks, /Andrea
Author
Owner

@DavidAnson commented on GitHub (Apr 21, 2020):

Understood! This will probably be part of the next round of updates (library->extension->CLI).

<!-- gh-comment-id:617254506 --> @DavidAnson commented on GitHub (Apr 21, 2020): Understood! This will probably be part of the next round of updates (library->extension->CLI).
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#2078
No description provided.