markdownlint/lib/md018.js
Milos Levacic 45424cf459 Change "header" to "heading" across the library
This should be backward compatible, as all "header" aliases are still
available, though documented as discouraged for future use.
2018-04-18 22:27:48 -07:00

19 lines
598 B
JavaScript

// @ts-check
"use strict";
var shared = require("./shared");
module.exports = {
"names": [ "MD018", "no-missing-space-atx" ],
"description": "No space after hash on atx style heading",
"tags": [ "headings", "headers", "atx", "spaces" ],
"function": function MD018(params, onError) {
shared.forEachLine(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.atxHeadingSpaceRe));
}
});
}
};