mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Change helpers.getReferenceLinkImageData().shortcuts from Set to Map using the same schema as .references (fixes #685).
This commit is contained in:
parent
f000a33481
commit
86a4a7de79
2 changed files with 24 additions and 18 deletions
|
@ -824,7 +824,7 @@ module.exports.emphasisMarkersInContent = emphasisMarkersInContent;
|
|||
function getReferenceLinkImageData(lineMetadata) {
|
||||
// Initialize return values
|
||||
const references = new Map();
|
||||
const shortcuts = new Set();
|
||||
const shortcuts = new Map();
|
||||
const definitions = new Map();
|
||||
const duplicateDefinitions = [];
|
||||
const definitionLineIndices = [];
|
||||
|
@ -920,19 +920,22 @@ function getReferenceLinkImageData(lineMetadata) {
|
|||
}
|
||||
const referenceIndex = referenceindex +
|
||||
(topLevel ? -lineOffsets[lineIndex] : contentIndex);
|
||||
const referenceDatum = [
|
||||
lineIndex,
|
||||
referenceIndex,
|
||||
matchString.length,
|
||||
matchText.length,
|
||||
(matchLabel || "").length
|
||||
];
|
||||
if (shortcutLink) {
|
||||
// Track separately due to ambiguity in "text [text] text"
|
||||
shortcuts.add(label);
|
||||
const shortcutData = shortcuts.get(label) || [];
|
||||
shortcutData.push(referenceDatum);
|
||||
shortcuts.set(label, shortcutData);
|
||||
} else {
|
||||
// Track reference and location
|
||||
const referenceData = references.get(label) || [];
|
||||
referenceData.push([
|
||||
lineIndex,
|
||||
referenceIndex,
|
||||
matchString.length,
|
||||
matchText.length,
|
||||
matchLabel.length
|
||||
]);
|
||||
referenceData.push(referenceDatum);
|
||||
references.set(label, referenceData);
|
||||
}
|
||||
// Check for links embedded in brackets
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue