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
21
lib/md023.js
Normal file
21
lib/md023.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
var shared = require("./shared");
|
||||
|
||||
var spaceBeforeHeaderRe = /^\s+\S/;
|
||||
|
||||
module.exports = {
|
||||
"names": [ "MD023", "header-start-left" ],
|
||||
"description": "Headers must start at the beginning of the line",
|
||||
"tags": [ "headers", "spaces" ],
|
||||
"function": function MD023(params, onError) {
|
||||
shared.filterTokens(params, "heading_open", function forToken(token) {
|
||||
if (spaceBeforeHeaderRe.test(token.line)) {
|
||||
shared.addErrorContext(onError, token.lineNumber, token.line, null,
|
||||
null, shared.rangeFromRegExp(token.line, spaceBeforeHeaderRe));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue