mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Update MD022/MD031/MD032 to report fixInfo for violations, normalize input to fixErrors.
This commit is contained in:
parent
2cd27c58f2
commit
a062e7c6bd
6 changed files with 357 additions and 38 deletions
29
lib/md022.js
29
lib/md022.js
|
|
@ -22,16 +22,33 @@ module.exports = {
|
|||
const [ topIndex, nextIndex ] = token.map;
|
||||
for (let i = 0; i < linesAbove; i++) {
|
||||
if (!isBlankLine(lines[topIndex - i - 1])) {
|
||||
addErrorDetailIf(onError, topIndex + 1, linesAbove, i, "Above",
|
||||
lines[topIndex].trim());
|
||||
return;
|
||||
addErrorDetailIf(
|
||||
onError,
|
||||
topIndex + 1,
|
||||
linesAbove,
|
||||
i,
|
||||
"Above",
|
||||
lines[topIndex].trim(),
|
||||
null,
|
||||
{
|
||||
"insertText": "\n"
|
||||
});
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < linesBelow; i++) {
|
||||
if (!isBlankLine(lines[nextIndex + i])) {
|
||||
addErrorDetailIf(onError, topIndex + 1, linesBelow, i, "Below",
|
||||
lines[topIndex].trim());
|
||||
return;
|
||||
addErrorDetailIf(
|
||||
onError,
|
||||
topIndex + 1,
|
||||
linesBelow,
|
||||
i,
|
||||
"Below",
|
||||
lines[topIndex].trim(),
|
||||
null,
|
||||
{
|
||||
"lineNumber": nextIndex + 1,
|
||||
"insertText": "\n"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue