mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-01-23 23:46:09 +01:00
Add infrastructure for rules to include fix information when logging violations, update MD047 (refs #80).
This commit is contained in:
parent
6e086114b1
commit
cdd87e647f
6 changed files with 248 additions and 19 deletions
|
|
@ -381,7 +381,8 @@ function lintContent(
|
|||
"lineNumber": errorInfo.lineNumber + frontMatterLines.length,
|
||||
"detail": errorInfo.detail || null,
|
||||
"context": errorInfo.context || null,
|
||||
"range": errorInfo.range || null
|
||||
"range": errorInfo.range || null,
|
||||
"fixInfo": errorInfo.fixInfo || null
|
||||
});
|
||||
}
|
||||
// Call (possibly external) rule function
|
||||
|
|
@ -423,6 +424,9 @@ function lintContent(
|
|||
errorObject.errorDetail = error.detail;
|
||||
errorObject.errorContext = error.context;
|
||||
errorObject.errorRange = error.range;
|
||||
if (resultVersion === 3) {
|
||||
errorObject.fixInfo = error.fixInfo;
|
||||
}
|
||||
return errorObject;
|
||||
});
|
||||
if (filteredErrors.length) {
|
||||
|
|
|
|||
12
lib/md047.js
12
lib/md047.js
|
|
@ -12,7 +12,17 @@ module.exports = {
|
|||
const lastLineNumber = params.lines.length;
|
||||
const lastLine = params.lines[lastLineNumber - 1];
|
||||
if (!isBlankLine(lastLine)) {
|
||||
addError(onError, lastLineNumber);
|
||||
addError(
|
||||
onError,
|
||||
lastLineNumber,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{
|
||||
"insertText": "\n",
|
||||
"editColumn": lastLine.length + 1
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue