mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Update MD039/no-space-in-links to handle hardbreaks (fixes #222).
This commit is contained in:
parent
fa9e08cf53
commit
1edb3f0a78
2 changed files with 9 additions and 4 deletions
|
|
@ -18,10 +18,11 @@ module.exports = {
|
||||||
let linkText = "";
|
let linkText = "";
|
||||||
let lineIndex = 0;
|
let lineIndex = 0;
|
||||||
children.forEach((child) => {
|
children.forEach((child) => {
|
||||||
if (child.type === "link_open") {
|
const { content, type } = child;
|
||||||
|
if (type === "link_open") {
|
||||||
inLink = true;
|
inLink = true;
|
||||||
linkText = "";
|
linkText = "";
|
||||||
} else if (child.type === "link_close") {
|
} else if (type === "link_close") {
|
||||||
inLink = false;
|
inLink = false;
|
||||||
const left = linkText.trimLeft().length !== linkText.length;
|
const left = linkText.trimLeft().length !== linkText.length;
|
||||||
const right = linkText.trimRight().length !== linkText.length;
|
const right = linkText.trimRight().length !== linkText.length;
|
||||||
|
|
@ -45,11 +46,11 @@ module.exports = {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (child.type === "softbreak") {
|
} else if ((type === "softbreak") || (type === "hardbreak")) {
|
||||||
lineNumber++;
|
lineNumber++;
|
||||||
lineIndex = 0;
|
lineIndex = 0;
|
||||||
} else if (inLink) {
|
} else if (inLink) {
|
||||||
linkText += child.content;
|
linkText += content;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -41,3 +41,7 @@ function MoreCodeButNotCode(input) {
|
||||||
input = input.replace(/[- ]([a-z])/g, "three"); // {MD039}
|
input = input.replace(/[- ]([a-z])/g, "three"); // {MD039}
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Links](ending)
|
||||||
|
[with](spaces)
|
||||||
|
[error ]({MD039})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue