-
-
Notifications
You must be signed in to change notification settings - Fork 730
/
md028.js
30 lines (27 loc) · 814 Bytes
/
md028.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// @ts-check
"use strict";
const { addError } = require("../helpers");
module.exports = {
"names": [ "MD028", "no-blanks-blockquote" ],
"description": "Blank line inside blockquote",
"tags": [ "blockquote", "whitespace" ],
"function": function MD028(params, onError) {
let prevToken = {};
let prevLineNumber = null;
for (const token of params.parsers.markdownit.tokens) {
if ((token.type === "blockquote_open") &&
(prevToken.type === "blockquote_close")) {
for (
let lineNumber = prevLineNumber;
lineNumber < token.lineNumber;
lineNumber++) {
addError(onError, lineNumber);
}
}
prevToken = token;
if (token.type === "blockquote_open") {
prevLineNumber = token.map[1] + 1;
}
}
}
};