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
20
lib/md031.js
Normal file
20
lib/md031.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
var shared = require("./shared");
|
||||
|
||||
module.exports = {
|
||||
"names": [ "MD031", "blanks-around-fences" ],
|
||||
"description": "Fenced code blocks should be surrounded by blank lines",
|
||||
"tags": [ "code", "blank_lines" ],
|
||||
"function": function MD031(params, onError) {
|
||||
var lines = params.lines;
|
||||
shared.forEachLine(params, function forLine(line, i, inCode, onFence) {
|
||||
if (((onFence > 0) && (i - 1 >= 0) && lines[i - 1].length) ||
|
||||
((onFence < 0) && (i + 1 < lines.length) && lines[i + 1].length)) {
|
||||
shared.addErrorContext(onError, i + 1, lines[i].trim());
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue