mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Update MD052/reference-links-images to add ignored_labels parameter and default to ignoring GFM task list items (fixes #1524).
This commit is contained in:
parent
c413ac9a88
commit
328506e6c8
19 changed files with 357 additions and 12 deletions
8
lib/configuration-strict.d.ts
vendored
8
lib/configuration-strict.d.ts
vendored
|
|
@ -996,6 +996,10 @@ export interface ConfigurationStrict {
|
|||
MD052?:
|
||||
| boolean
|
||||
| {
|
||||
/**
|
||||
* Ignored link labels
|
||||
*/
|
||||
ignored_labels?: string[];
|
||||
/**
|
||||
* Include shortcut syntax
|
||||
*/
|
||||
|
|
@ -1007,6 +1011,10 @@ export interface ConfigurationStrict {
|
|||
"reference-links-images"?:
|
||||
| boolean
|
||||
| {
|
||||
/**
|
||||
* Ignored link labels
|
||||
*/
|
||||
ignored_labels?: string[];
|
||||
/**
|
||||
* Include shortcut syntax
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export default {
|
|||
"function": function MD052(params, onError) {
|
||||
const { config, lines } = params;
|
||||
const shortcutSyntax = config.shortcut_syntax || false;
|
||||
const ignoredLabels = new Set(config.ignored_labels || [ "x" ]);
|
||||
const { definitions, references, shortcuts } = getReferenceLinkImageData();
|
||||
const entries = shortcutSyntax ?
|
||||
[ ...references.entries(), ...shortcuts.entries() ] :
|
||||
|
|
@ -20,7 +21,7 @@ export default {
|
|||
// Look for links/images that use an undefined link reference
|
||||
for (const reference of entries) {
|
||||
const [ label, datas ] = reference;
|
||||
if (!definitions.has(label)) {
|
||||
if (!definitions.has(label) && !ignoredLabels.has(label)) {
|
||||
for (const data of datas) {
|
||||
const [ lineIndex, index, length ] = data;
|
||||
// Context will be incomplete if reporting for a multi-line link
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue