mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-21 21:30:47 +02:00
21 lines
686 B
JavaScript
21 lines
686 B
JavaScript
// @ts-check
|
|
|
|
"use strict";
|
|
|
|
const { addErrorContext, atxHeadingSpaceRe, forEachLine,
|
|
rangeFromRegExp } = require("../helpers");
|
|
const { lineMetadata } = require("./cache");
|
|
|
|
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) {
|
|
forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
|
|
if (!inCode && /^#+[^#\s]/.test(line) && !/#$/.test(line)) {
|
|
addErrorContext(onError, lineIndex + 1, line.trim(), null,
|
|
null, rangeFromRegExp(line, atxHeadingSpaceRe));
|
|
}
|
|
});
|
|
}
|
|
};
|