mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Update MD052/reference-links-images to add a shortcut_syntax parameter for opting into shortcut scanning (fixes #915).
This commit is contained in:
parent
a736588958
commit
c118c1160a
13 changed files with 433 additions and 29 deletions
10
lib/md052.js
10
lib/md052.js
|
|
@ -11,10 +11,14 @@ module.exports = {
|
|||
"Reference links and images should use a label that is defined",
|
||||
"tags": [ "images", "links" ],
|
||||
"function": function MD052(params, onError) {
|
||||
const { lines } = params;
|
||||
const { references, definitions } = referenceLinkImageData();
|
||||
const { config, lines } = params;
|
||||
const shortcutSyntax = config.shortcut_syntax || false;
|
||||
const { definitions, references, shortcuts } = referenceLinkImageData();
|
||||
const entries = shortcutSyntax ?
|
||||
[ ...references.entries(), ...shortcuts.entries() ] :
|
||||
references.entries();
|
||||
// Look for links/images that use an undefined link reference
|
||||
for (const reference of references.entries()) {
|
||||
for (const reference of entries) {
|
||||
const [ label, datas ] = reference;
|
||||
if (!definitions.has(label)) {
|
||||
for (const data of datas) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue