[PR #2] [CLOSED] feature(config): adding config.ignore to replace metadata #2647

Closed
opened 2026-03-07 20:09:54 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/DavidAnson/markdownlint/pull/2
Author: @rodneyrehm
Created: 7/20/2015
Status: Closed

Base: masterHead: feature/ignore-frontmatter


📝 Commits (1)

  • 414e774 feature(config): adding config.ignore to replace metadata (e.g. frontmatter) before linting

📊 Changes

4 files changed (+41 additions, -0 deletions)

View changed files

📝 README.md (+1 -0)
📝 lib/markdownlint.js (+28 -0)
test/ignore_frontmatter.json (+5 -0)
test/ignore_frontmatter.md (+7 -0)

📄 Description

My markdown files contain frontmatter to configure the documentation build system. That code is erroneously detected as a headline and subsequently fails MD002 and MD003. (github displays the frontmatter as a table). Should you wish to parse the the frontmatter properly, the gray-matter package might be a good place to start.

This PR adds the config option ignore with which any part of a markdown file can be replaced by line breaks (to preserve the line-markings of the actual tests) before the markdown file is linted. Because frontmatter seems to be used by a couple of systems (Jekyll and metalsmith being the ones I use), I added the regular expression to your code directly and acitvating it if config.ignore === 'frontmatter' is passed in.

Cheers!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/DavidAnson/markdownlint/pull/2 **Author:** [@rodneyrehm](https://github.com/rodneyrehm) **Created:** 7/20/2015 **Status:** ❌ Closed **Base:** `master` ← **Head:** `feature/ignore-frontmatter` --- ### 📝 Commits (1) - [`414e774`](https://github.com/DavidAnson/markdownlint/commit/414e7744802a022ea1db1c2520bc372cb1e67a5e) feature(config): adding config.ignore to replace metadata (e.g. frontmatter) before linting ### 📊 Changes **4 files changed** (+41 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -0) 📝 `lib/markdownlint.js` (+28 -0) ➕ `test/ignore_frontmatter.json` (+5 -0) ➕ `test/ignore_frontmatter.md` (+7 -0) </details> ### 📄 Description My markdown files contain [frontmatter](http://jekyllrb.com/docs/frontmatter/) to configure the documentation build system. That code is erroneously detected as a headline and subsequently fails MD002 and MD003. (github displays the frontmatter as a table). Should you wish to parse the the frontmatter properly, the [gray-matter](https://www.npmjs.com/package/gray-matter) package might be a good place to start. This PR adds the config option `ignore` with which any part of a markdown file can be replaced by line breaks (to preserve the line-markings of the actual tests) before the markdown file is linted. Because frontmatter seems to be used by a couple of systems (Jekyll and metalsmith being the ones I use), I added the regular expression to your code directly and acitvating it if `config.ignore === 'frontmatter'` is passed in. Cheers! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-07 20:09:54 +03:00
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#2647
No description provided.