2018-01-21 21:44:25 -08:00
|
|
|
// @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) {
|
2018-03-04 23:06:31 -08:00
|
|
|
shared.forEachLine(function forLine(line, lineIndex, inCode) {
|
2018-01-21 21:44:25 -08:00
|
|
|
if (!inCode && /^#+[^#\s]/.test(line) && !/#$/.test(line)) {
|
|
|
|
|
shared.addErrorContext(onError, lineIndex + 1, line.trim(), null,
|
|
|
|
|
null, shared.rangeFromRegExp(line, shared.atxHeaderSpaceRe));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|