mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-18 06:50: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
20
lib/md031.js
20
lib/md031.js
|
|
@ -14,10 +14,22 @@ module.exports = {
|
|||
const includeListItems = (listItems === undefined) ? true : !!listItems;
|
||||
const { lines } = params;
|
||||
forEachLine(lineMetadata(), (line, i, inCode, onFence, inTable, inItem) => {
|
||||
if ((((onFence > 0) && !isBlankLine(lines[i - 1])) ||
|
||||
((onFence < 0) && !isBlankLine(lines[i + 1]))) &&
|
||||
(includeListItems || !inItem)) {
|
||||
addErrorContext(onError, i + 1, lines[i].trim());
|
||||
const onTopFence = (onFence > 0);
|
||||
const onBottomFence = (onFence < 0);
|
||||
if ((includeListItems || !inItem) &&
|
||||
((onTopFence && !isBlankLine(lines[i - 1])) ||
|
||||
(onBottomFence && !isBlankLine(lines[i + 1])))) {
|
||||
addErrorContext(
|
||||
onError,
|
||||
i + 1,
|
||||
lines[i].trim(),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{
|
||||
"lineNumber": i + (onTopFence ? 1 : 2),
|
||||
"insertText": "\n"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue