mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Update MD044/proper-names to avoid providing bogus range when proper name could not be found.
This commit is contained in:
parent
f635d7b72c
commit
87aac66d68
2 changed files with 21 additions and 6 deletions
15
lib/md044.js
15
lib/md044.js
|
|
@ -40,7 +40,14 @@ module.exports = {
|
||||||
// Attempt to fix bad offset due to inline content
|
// Attempt to fix bad offset due to inline content
|
||||||
matchIndex = fullLine.indexOf(wordMatch);
|
matchIndex = fullLine.indexOf(wordMatch);
|
||||||
}
|
}
|
||||||
const range = [ matchIndex + 1, matchLength ];
|
const range = (matchIndex === -1) ?
|
||||||
|
null :
|
||||||
|
[ matchIndex + 1, matchLength ];
|
||||||
|
const fixInfo = (matchIndex === -1) ? null : {
|
||||||
|
"editColumn": matchIndex + 1,
|
||||||
|
"deleteCount": matchLength,
|
||||||
|
"insertText": name
|
||||||
|
};
|
||||||
addErrorDetailIf(
|
addErrorDetailIf(
|
||||||
onError,
|
onError,
|
||||||
lineNumber,
|
lineNumber,
|
||||||
|
|
@ -49,11 +56,7 @@ module.exports = {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
range,
|
range,
|
||||||
{
|
fixInfo
|
||||||
"editColumn": matchIndex + 1,
|
|
||||||
"deleteCount": matchLength,
|
|
||||||
"insertText": name
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,3 +69,15 @@ Bare URL exempt https://github.com/DavidAnson/MARKDOWNLINT {MD034}
|
||||||
A short paragraph
|
A short paragraph
|
||||||
about node.js and {MD044}
|
about node.js and {MD044}
|
||||||
javascript. {MD044}
|
javascript. {MD044}
|
||||||
|
|
||||||
|
{MD044} `javascript`
|
||||||
|
|
||||||
|
{MD044} `code
|
||||||
|
javascript`
|
||||||
|
|
||||||
|
{MD044} `code
|
||||||
|
javascript
|
||||||
|
code`
|
||||||
|
|
||||||
|
{MD044} `javascript
|
||||||
|
code`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue