mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-02-16 18:28:07 +01:00
Automatically ignore common front matter; provide option for customization (fixes #2).
This commit is contained in:
parent
cae451967a
commit
a467f8b3e6
11 changed files with 134 additions and 54 deletions
9
test/front-matter-embedded.md
Normal file
9
test/front-matter-embedded.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
Text text text
|
||||
|
||||
---
|
||||
layout: post
|
||||
hard: tab {MD010}
|
||||
title: embedded
|
||||
---
|
||||
|
||||
Text text text
|
||||
5
test/front-matter-empty.md
Normal file
5
test/front-matter-empty.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
---
|
||||
# Header
|
||||
|
||||
# Another {MD025}
|
||||
10
test/front-matter-with-dashes.md
Normal file
10
test/front-matter-with-dashes.md
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
layout: post
|
||||
title: Title with ---
|
||||
tags: front matter
|
||||
---
|
||||
## Header {MD002}
|
||||
|
||||
---
|
||||
|
||||
Hard tab {MD010}
|
||||
7
test/front-matter.md
Normal file
7
test/front-matter.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
front: matter
|
||||
---
|
||||
|
||||
# Header 1
|
||||
|
||||
## Header 2
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"default": true,
|
||||
"ignore": "frontmatter",
|
||||
"MD012": false
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
---
|
||||
front: matter
|
||||
---
|
||||
|
||||
# Header 1 #
|
||||
|
||||
## Header 2 ##
|
||||
|
|
@ -505,6 +505,48 @@ module.exports.styleRelaxed = function styleRelaxed(test) {
|
|||
});
|
||||
};
|
||||
|
||||
module.exports.nullFrontMatter = function nullFrontMatter(test) {
|
||||
test.expect(2);
|
||||
markdownlint({
|
||||
"strings": {
|
||||
"content": "---\n\t\n---\n# Header\n"
|
||||
},
|
||||
"frontMatter": null,
|
||||
"config": {
|
||||
"default": false,
|
||||
"MD010": true
|
||||
}
|
||||
}, function callback(err, result) {
|
||||
test.ifError(err);
|
||||
var expectedResult = {
|
||||
"content": { "MD010": [ 2 ] }
|
||||
};
|
||||
test.deepEqual(result, expectedResult, "Undetected issues.");
|
||||
test.done();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.customFrontMatter = function customFrontMatter(test) {
|
||||
test.expect(2);
|
||||
markdownlint({
|
||||
"strings": {
|
||||
"content": "<head>\n\t\n</head>\n# Header\n"
|
||||
},
|
||||
"frontMatter": /<head>[^]*<\/head>/,
|
||||
"config": {
|
||||
"default": false,
|
||||
"MD010": true
|
||||
}
|
||||
}, function callback(err, result) {
|
||||
test.ifError(err);
|
||||
var expectedResult = {
|
||||
"content": {}
|
||||
};
|
||||
test.deepEqual(result, expectedResult, "Did not get empty results.");
|
||||
test.done();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.filesArrayNotModified = function filesArrayNotModified(test) {
|
||||
test.expect(2);
|
||||
var files = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue