mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Add MD020, MD021 with tests.
This commit is contained in:
parent
d0fcd32f3a
commit
35067149c9
3 changed files with 49 additions and 1 deletions
29
lib/rules.js
29
lib/rules.js
|
|
@ -270,7 +270,7 @@ module.exports = [
|
|||
"desc": "No space after hash on atx style header",
|
||||
"func": function MD018(params, errors) {
|
||||
params.lines.forEach(function forLine(line, lineIndex) {
|
||||
if (/^#+[^#\s]/.test(line)) {
|
||||
if (/^#+[^#\s]/.test(line) && !/#$/.test(line)) {
|
||||
errors.push(lineIndex + 1);
|
||||
}
|
||||
});
|
||||
|
|
@ -291,6 +291,33 @@ module.exports = [
|
|||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "MD020",
|
||||
"desc": "No space inside hashes on closed atx style header",
|
||||
"func": function MD020(params, errors) {
|
||||
params.lines.forEach(function forLine(line, lineIndex) {
|
||||
if (/^#+[^#]*[^\\]#+$/.test(line) &&
|
||||
(/^#+[^#\s]/.test(line) || /[^#\s]#+$/.test(line))) {
|
||||
errors.push(lineIndex + 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "MD021",
|
||||
"desc": "Multiple spaces inside hashes on closed atx style header",
|
||||
"func": function MD021(params, errors) {
|
||||
filterTokens(params.tokens, "heading_open")
|
||||
.forEach(function forToken(token) {
|
||||
if ((headingStyleFor(token) === "atx_closed") &&
|
||||
(/^#+\s\s/.test(token.line) || /\s\s#+$/.test(token.line))) {
|
||||
errors.push(token.lineNumber);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "MD028",
|
||||
"desc": "Blank line inside blockquote",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue