Re-implement MD022/blanks-around-headings to ignore comments and blockquotes.

This commit is contained in:
David Anson 2019-03-21 21:42:24 -07:00
parent 1db87ef0c6
commit debc08bca1
5 changed files with 16 additions and 35 deletions

View file

@ -11,10 +11,9 @@ module.exports = {
"tags": [ "code", "blank_lines" ],
"function": function MD031(params, onError) {
const { lines } = params;
const { length } = lines;
forEachLine(function forLine(line, i, inCode, onFence) {
if (((onFence > 0) && (i - 1 >= 0) && !isBlankLine(lines[i - 1])) ||
((onFence < 0) && (i + 1 < length) && !isBlankLine(lines[i + 1]))) {
if (((onFence > 0) && !isBlankLine(lines[i - 1])) ||
((onFence < 0) && !isBlankLine(lines[i + 1]))) {
addErrorContext(onError, i + 1, lines[i].trim());
}
});