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]);
}
}
}
});

View file

@ -0,0 +1,16 @@
{
"default": true,
"proper-names": {
"names": [
"GitHub",
"github.com",
"github.com/about",
"npm",
"NPM",
"Vue",
"Vuex",
"vue-router"
],
"code_blocks": false
}
}

View file

@ -0,0 +1,45 @@
# Proper Names of Projects (code_blocks:false)
The site GitHub
Not github {MD044}
Link to [GitHub](https://github.com/)
Link to [github.com](https://github.com/)
Link to [github.com](https://github.com/about)
Link to [github.com/about](https://github.com/about)
The domain name of GitHub is github.com
The project Vue
AKA Vue.js
Not vue {MD044}
Or vue.js {MD044}
The file `vue.js` (code block)
The library Vuex
Not vuex {MD044}
The library vue-router
Not Vue-router {MD044}
Or vue-router-extra {MD044}
Or extra-vue-router {MD044}
Quoted "Vue" and "vue-router"
Emphasized *Vue* and *vue-router*
Call it npm
Or NPM
But not Npm {MD044}

View file

@ -2,6 +2,12 @@
Markdownlint is a tool {MD044}
Quoted "Markdownlint" {MD044}
Emphasized *Markdownlint* {MD044}
Emphasized _Markdownlint_ {MD044}
JavaScript is a language
JavaScript is not Java