mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +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 lineIndex = 0;
|
||||
children.forEach((child) => {
|
||||
if (child.type === "link_open") {
|
||||
const { content, type } = child;
|
||||
if (type === "link_open") {
|
||||
inLink = true;
|
||||
linkText = "";
|
||||
} else if (child.type === "link_close") {
|
||||
} else if (type === "link_close") {
|
||||
inLink = false;
|
||||
const left = linkText.trimLeft().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++;
|
||||
lineIndex = 0;
|
||||
} else if (inLink) {
|
||||
linkText += child.content;
|
||||
linkText += content;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -41,3 +41,7 @@ function MoreCodeButNotCode(input) {
|
|||
input = input.replace(/[- ]([a-z])/g, "three"); // {MD039}
|
||||
return input;
|
||||
}
|
||||
|
||||
[Links](ending)
|
||||
[with](spaces)
|
||||
[error ]({MD039})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue