mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-24 01:40:13 +01:00
Move each rule implementation into its own file (fixes #83).
This commit is contained in:
parent
49e36f817c
commit
9ba143555d
42 changed files with 1289 additions and 1028 deletions
19
lib/md018.js
Normal file
19
lib/md018.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
var shared = require("./shared");
|
||||
|
||||
module.exports = {
|
||||
"names": [ "MD018", "no-missing-space-atx" ],
|
||||
"description": "No space after hash on atx style header",
|
||||
"tags": [ "headers", "atx", "spaces" ],
|
||||
"function": function MD018(params, onError) {
|
||||
shared.forEachLine(params, function forLine(line, lineIndex, inCode) {
|
||||
if (!inCode && /^#+[^#\s]/.test(line) && !/#$/.test(line)) {
|
||||
shared.addErrorContext(onError, lineIndex + 1, line.trim(), null,
|
||||
null, shared.rangeFromRegExp(line, shared.atxHeaderSpaceRe));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue