mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
MD014 should not warn for empty blocks.
This commit is contained in:
parent
fb31bb5f35
commit
26ab9a5596
3 changed files with 23 additions and 2 deletions
|
|
@ -342,10 +342,11 @@ module.exports = [
|
||||||
"func": function MD014(params, errors) {
|
"func": function MD014(params, errors) {
|
||||||
[ "code_block", "fence" ].forEach(function forType(type) {
|
[ "code_block", "fence" ].forEach(function forType(type) {
|
||||||
filterTokens(params, type, function forToken(token) {
|
filterTokens(params, type, function forToken(token) {
|
||||||
|
var allBlank = true;
|
||||||
if (token.content && token.content.split(shared.newLineRe)
|
if (token.content && token.content.split(shared.newLineRe)
|
||||||
.every(function forLine(line) {
|
.every(function forLine(line) {
|
||||||
return !line || /^\$\s/.test(line);
|
return !line || (allBlank = false) || /^\$\s/.test(line);
|
||||||
})) {
|
}) && !allBlank) {
|
||||||
errors.push(token.lineNumber);
|
errors.push(token.lineNumber);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
6
test/code_block_dollar_fence-empty.json
Normal file
6
test/code_block_dollar_fence-empty.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"default": true,
|
||||||
|
"MD009": {
|
||||||
|
"br_spaces": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
14
test/code_block_dollar_fence-empty.md
Normal file
14
test/code_block_dollar_fence-empty.md
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Header
|
||||||
|
|
||||||
|
```js
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```css
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```spaces
|
||||||
|
|
||||||
|
```
|
||||||
Loading…
Add table
Add a link
Reference in a new issue