Add rule MD059/descriptive-link-text "Link text should be descriptive" (fixes #681).

This commit is contained in:
Kate Higa 2025-01-06 11:35:17 -05:00 committed by David Anson
parent 4117394250
commit b8374ec5d2
40 changed files with 1159 additions and 234 deletions

View file

@ -306,5 +306,11 @@
"MD056": true,
// MD058/blanks-around-tables : Tables should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md058.md
"MD058": true
"MD058": true,
// MD059/descriptive-link-text : Link text should be descriptive : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md059.md
"MD059": {
// List of restricted link texts
"link_texts": []
}
}

View file

@ -275,3 +275,8 @@ MD056: true
# MD058/blanks-around-tables : Tables should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md058.md
MD058: true
# MD059/descriptive-link-text : Link text should be descriptive : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md059.md
MD059:
# List of restricted link texts
link_texts: []

View file

@ -556,6 +556,18 @@ for (const rule of rules) {
}
};
break;
case "MD059":
scheme.properties = {
"link_texts": {
"description": "List of restricted link texts",
"type": "array",
"items": {
"type": "string"
},
"default": []
}
};
break;
default:
custom = false;
break;

View file

@ -1716,6 +1716,44 @@
"type": "boolean",
"default": true
},
"MD059": {
"description": "MD059/descriptive-link-text : Link text should be descriptive : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md059.md",
"type": [
"boolean",
"object"
],
"default": true,
"properties": {
"link_texts": {
"description": "List of restricted link texts",
"type": "array",
"items": {
"type": "string"
},
"default": []
}
},
"additionalProperties": false
},
"descriptive-link-text": {
"description": "MD059/descriptive-link-text : Link text should be descriptive : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md059.md",
"type": [
"boolean",
"object"
],
"default": true,
"properties": {
"link_texts": {
"description": "List of restricted link texts",
"type": "array",
"items": {
"type": "string"
},
"default": []
}
},
"additionalProperties": false
},
"headings": {
"description": "headings : MD001, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043",
"type": "boolean",
@ -1747,7 +1785,7 @@
"default": true
},
"links": {
"description": "links : MD011, MD034, MD039, MD042, MD051, MD052, MD053, MD054",
"description": "links : MD011, MD034, MD039, MD042, MD051, MD052, MD053, MD054, MD059",
"type": "boolean",
"default": true
},
@ -1822,7 +1860,7 @@
"default": true
},
"accessibility": {
"description": "accessibility : MD045",
"description": "accessibility : MD045, MD059",
"type": "boolean",
"default": true
},

View file

@ -1716,6 +1716,44 @@
"type": "boolean",
"default": true
},
"MD059": {
"description": "MD059/descriptive-link-text : Link text should be descriptive : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md059.md",
"type": [
"boolean",
"object"
],
"default": true,
"properties": {
"link_texts": {
"description": "List of restricted link texts",
"type": "array",
"items": {
"type": "string"
},
"default": []
}
},
"additionalProperties": false
},
"descriptive-link-text": {
"description": "MD059/descriptive-link-text : Link text should be descriptive : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md059.md",
"type": [
"boolean",
"object"
],
"default": true,
"properties": {
"link_texts": {
"description": "List of restricted link texts",
"type": "array",
"items": {
"type": "string"
},
"default": []
}
},
"additionalProperties": false
},
"headings": {
"description": "headings : MD001, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043",
"type": "boolean",
@ -1747,7 +1785,7 @@
"default": true
},
"links": {
"description": "links : MD011, MD034, MD039, MD042, MD051, MD052, MD053, MD054",
"description": "links : MD011, MD034, MD039, MD042, MD051, MD052, MD053, MD054, MD059",
"type": "boolean",
"default": true
},
@ -1822,7 +1860,7 @@
"default": true
},
"accessibility": {
"description": "accessibility : MD045",
"description": "accessibility : MD045, MD059",
"type": "boolean",
"default": true
},