mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-22 17:00:13 +01:00
Remove state from shared.js, move to cache.js.
This commit is contained in:
parent
827e1acb56
commit
f614f3e1ce
17 changed files with 124 additions and 98 deletions
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const shared = require("./shared");
|
||||
const { addErrorContext, forEachLine, isBlankLine } = shared;
|
||||
const { addErrorContext, forEachLine, isBlankLine } = require("./shared");
|
||||
const { lineMetadata } = require("./cache");
|
||||
|
||||
module.exports = {
|
||||
"names": [ "MD031", "blanks-around-fences" ],
|
||||
|
|
@ -11,7 +11,7 @@ module.exports = {
|
|||
"tags": [ "code", "blank_lines" ],
|
||||
"function": function MD031(params, onError) {
|
||||
const { lines } = params;
|
||||
forEachLine(function forLine(line, i, inCode, onFence) {
|
||||
forEachLine(lineMetadata(), (line, i, inCode, onFence) => {
|
||||
if (((onFence > 0) && !isBlankLine(lines[i - 1])) ||
|
||||
((onFence < 0) && !isBlankLine(lines[i + 1]))) {
|
||||
addErrorContext(onError, i + 1, lines[i].trim());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue