mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Update MD044/proper-names to ignore non-text content like link targets.
This commit is contained in:
parent
1b44ed54e4
commit
935935b96c
2 changed files with 35 additions and 6 deletions
21
lib/rules.js
21
lib/rules.js
|
|
@ -1128,12 +1128,21 @@ module.exports = [
|
|||
var escapedName = escapeForRegExp(name);
|
||||
var namePattern = "\\b" + escapedName + "\\b";
|
||||
var anyNameRe = new RegExp(namePattern, "gi");
|
||||
forEachLine(params, function forLine(line, lineIndex) {
|
||||
var matches = line.match(anyNameRe) || [];
|
||||
matches.forEach(function forMatch(match) {
|
||||
errors.addDetailIf(lineIndex + 1, name, match);
|
||||
});
|
||||
});
|
||||
function forToken(token) {
|
||||
var fenceOffset = (token.type === "fence") ? 1 : 0;
|
||||
token.content.split(shared.newLineRe)
|
||||
.forEach(function forLine(line, index) {
|
||||
var matches = line.match(anyNameRe) || [];
|
||||
matches.forEach(function forMatch(match) {
|
||||
var lineNumber = token.lineNumber + index + fenceOffset;
|
||||
errors.addDetailIf(lineNumber, name, match);
|
||||
});
|
||||
});
|
||||
}
|
||||
forEachInlineChild(params, "text", forToken);
|
||||
forEachInlineChild(params, "code_inline", forToken);
|
||||
filterTokens(params, "code_block", forToken);
|
||||
filterTokens(params, "fence", forToken);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,10 +36,30 @@ Code in `javascript` {MD044}
|
|||
|
||||
Execute `via the node.js engine` {MD044}
|
||||
|
||||
HTML <u>javascript</u> {MD033} {MD044}
|
||||
|
||||
* Use NPM {MD044}
|
||||
|
||||
> Run Markdownlint on your README {MD044}
|
||||
|
||||
javascript is code {MD044}
|
||||
node.js is runtime {MD044}
|
||||
|
||||
```js
|
||||
javascript is code {MD044}
|
||||
node.js is runtime {MD044}
|
||||
```
|
||||
|
||||
Upload the code (to github) {MD044}
|
||||
|
||||
Link to [github](https://github.com/). {MD044}
|
||||
|
||||
Link to [GitHub](https://github.com/).
|
||||
|
||||
Link to [markdownlint](https://github.com/DavidAnson/MARKDOWNLINT).
|
||||
|
||||
Bare URL https://github.com/DavidAnson/markdownlint {MD034} {MD044}
|
||||
|
||||
A short paragraph
|
||||
about node.js and {MD044}
|
||||
javascript. {MD044}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue