Allow overlapping and differently-cased names for MD044/proper-names (fixes #60).

This commit is contained in:
David Anson 2017-06-15 22:53:33 -07:00
parent d63143b38e
commit edd426bbaa
4 changed files with 75 additions and 3 deletions

View file

@ -1157,9 +1157,14 @@ module.exports = [
.forEach(function forLine(line, index) {
var match = null;
while ((match = anyNameRe.exec(line)) !== null) {
if (!bareUrlRe.test(match[0])) {
var lineNumber = token.lineNumber + index + fenceOffset;
errors.addDetailIf(lineNumber, name, match[1]);
var fullMatch = match[0];
if (!bareUrlRe.test(fullMatch)) {
var wordMatch = fullMatch
.replace(/^\W*/, "").replace(/\W*$/, "");
if (names.indexOf(wordMatch) === -1) {
var lineNumber = token.lineNumber + index + fenceOffset;
errors.addDetailIf(lineNumber, name, match[1]);
}
}
}
});