mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Add detail to MD029/ol-prefix message to help distinguish 1/1/1 from 1/2/3.
This commit is contained in:
parent
0fd322a380
commit
f910fa0cb1
3 changed files with 7 additions and 5 deletions
|
@ -235,11 +235,12 @@ function lintContent(
|
|||
addError(lineNumber, detail);
|
||||
};
|
||||
errors.addDetailIf =
|
||||
function addDetailIf(lineNumber, expected, actual, range) {
|
||||
function addDetailIf(lineNumber, expected, actual, detail, range) {
|
||||
if (expected !== actual) {
|
||||
addError(
|
||||
lineNumber,
|
||||
"Expected: " + expected + "; Actual: " + actual,
|
||||
"Expected: " + expected + "; Actual: " + actual +
|
||||
(detail ? "; " + detail : ""),
|
||||
null,
|
||||
range);
|
||||
}
|
||||
|
|
|
@ -752,7 +752,8 @@ module.exports = [
|
|||
list.items.forEach(function forItem(item) {
|
||||
var match = /^[\s>]*([^.)]*)[.)]/.exec(item.line);
|
||||
errors.addDetailIf(item.lineNumber,
|
||||
String(number), !match || match[1]);
|
||||
String(number), !match || match[1],
|
||||
"Style: " + (style === "one" ? "1/1/1" : "1/2/3"));
|
||||
if (style === "ordered") {
|
||||
number++;
|
||||
}
|
||||
|
@ -1187,7 +1188,7 @@ module.exports = [
|
|||
if (names.indexOf(wordMatch) === -1) {
|
||||
var lineNumber = token.lineNumber + index + fenceOffset;
|
||||
var range = [ match.index + 1, wordMatch.length ];
|
||||
errors.addDetailIf(lineNumber, name, match[1], range);
|
||||
errors.addDetailIf(lineNumber, name, match[1], null, range);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
"ruleName": "MD029",
|
||||
"ruleAlias": "ol-prefix",
|
||||
"ruleDescription": "Ordered list item prefix",
|
||||
"errorDetail": "Expected: 1; Actual: 2",
|
||||
"errorDetail": "Expected: 1; Actual: 2; Style: 1/1/1",
|
||||
"errorContext": null,
|
||||
"errorRange": [1, 4]
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue