mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10: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 escapedName = escapeForRegExp(name);
|
||||||
var namePattern = "\\b" + escapedName + "\\b";
|
var namePattern = "\\b" + escapedName + "\\b";
|
||||||
var anyNameRe = new RegExp(namePattern, "gi");
|
var anyNameRe = new RegExp(namePattern, "gi");
|
||||||
forEachLine(params, function forLine(line, lineIndex) {
|
function forToken(token) {
|
||||||
var matches = line.match(anyNameRe) || [];
|
var fenceOffset = (token.type === "fence") ? 1 : 0;
|
||||||
matches.forEach(function forMatch(match) {
|
token.content.split(shared.newLineRe)
|
||||||
errors.addDetailIf(lineIndex + 1, name, match);
|
.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}
|
Execute `via the node.js engine` {MD044}
|
||||||
|
|
||||||
|
HTML <u>javascript</u> {MD033} {MD044}
|
||||||
|
|
||||||
* Use NPM {MD044}
|
* Use NPM {MD044}
|
||||||
|
|
||||||
> Run Markdownlint on your README {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}
|
Upload the code (to github) {MD044}
|
||||||
|
|
||||||
Link to [github](https://github.com/). {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