Refactor new MD054/link-image-style rule, add tests, update documentation (fixes #40, fixes #399).

This commit is contained in:
David Anson 2023-10-25 20:05:19 -07:00
parent 460836445c
commit 10f095c4fd
32 changed files with 3149 additions and 333 deletions

View file

@ -263,13 +263,13 @@
"style": "consistent"
},
// MD049/emphasis-style - Emphasis style should be consistent
// MD049/emphasis-style - Emphasis style
"MD049": {
// Emphasis style
"style": "consistent"
},
// MD050/strong-style - Strong style should be consistent
// MD050/strong-style - Strong style
"MD050": {
// Strong style
"style": "consistent"
@ -290,5 +290,15 @@
"ignored_definitions": [
"//"
]
},
// MD054/link-image-style - Link and image style
"MD054": {
// Allow autolinks
"autolink": true,
// Allow inline links and images
"inline": true,
// Allow reference links and images
"reference": true
}
}

View file

@ -238,12 +238,12 @@ MD048:
# Code fence style
style: "consistent"
# MD049/emphasis-style - Emphasis style should be consistent
# MD049/emphasis-style - Emphasis style
MD049:
# Emphasis style
style: "consistent"
# MD050/strong-style - Strong style should be consistent
# MD050/strong-style - Strong style
MD050:
# Strong style
style: "consistent"
@ -261,3 +261,12 @@ MD053:
# Ignored definitions
ignored_definitions:
- "//"
# MD054/link-image-style - Link and image style
MD054:
# Allow autolinks
autolink: true
# Allow inline links and images
inline: true
# Allow reference links and images
reference: true

View file

@ -521,19 +521,20 @@ for (const rule of rules) {
break;
case "MD054":
scheme.properties = {
"style": {
"description": "Link or image style should be consistent",
"type": "string",
"enum": [
"mixed",
"autolink_only",
"inline_only",
"reference_only",
"inline_or_reference",
"inline_or_autolink",
"reference_or_autolink"
],
"default": "mixed"
"autolink": {
"description": "Allow autolinks",
"type": "boolean",
"default": true
},
"inline": {
"description": "Allow inline links and images",
"type": "boolean",
"default": true
},
"reference": {
"description": "Allow reference links and images",
"type": "boolean",
"default": true
}
};
break;

View file

@ -881,7 +881,7 @@
"$ref": "#/properties/MD048"
},
"MD049": {
"description": "MD049/emphasis-style - Emphasis style should be consistent",
"description": "MD049/emphasis-style - Emphasis style",
"type": [
"boolean",
"object"
@ -905,7 +905,7 @@
"$ref": "#/properties/MD049"
},
"MD050": {
"description": "MD050/strong-style - Strong style should be consistent",
"description": "MD050/strong-style - Strong style",
"type": [
"boolean",
"object"
@ -979,6 +979,35 @@
"link-image-reference-definitions": {
"$ref": "#/properties/MD053"
},
"MD054": {
"description": "MD054/link-image-style - Link and image style",
"type": [
"boolean",
"object"
],
"default": true,
"properties": {
"autolink": {
"description": "Allow autolinks",
"type": "boolean",
"default": true
},
"inline": {
"description": "Allow inline links and images",
"type": "boolean",
"default": true
},
"reference": {
"description": "Allow reference links and images",
"type": "boolean",
"default": true
}
},
"additionalProperties": false
},
"link-image-style": {
"$ref": "#/properties/MD054"
},
"headings": {
"description": "headings - MD001, MD002, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043",
"type": "boolean",
@ -1015,7 +1044,7 @@
"default": true
},
"links": {
"description": "links - MD011, MD034, MD039, MD042, MD051, MD052, MD053",
"description": "links - MD011, MD034, MD039, MD042, MD051, MD052, MD053, MD054",
"type": "boolean",
"default": true
},
@ -1095,7 +1124,7 @@
"default": true
},
"images": {
"description": "images - MD045, MD052, MD053",
"description": "images - MD045, MD052, MD053, MD054",
"type": "boolean",
"default": true
}