mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Update MD032/blanks-around-lists to ignore (end-appended) undefined reference tokens when determining the last line of a list (fixes #1453).
This commit is contained in:
parent
599b687849
commit
8ad4698536
5 changed files with 24 additions and 10 deletions
|
|
@ -45,13 +45,14 @@ export default {
|
|||
}
|
||||
|
||||
// Find the "visual" end of the list
|
||||
const flattenedChildren = filterByPredicate(
|
||||
list.children,
|
||||
(token) => !nonContentTokens.has(token.type),
|
||||
(token) => nonContentTokens.has(token.type) ? [] : token.children
|
||||
);
|
||||
let endLine = list.endLine;
|
||||
const flattenedChildren = filterByPredicate(list.children);
|
||||
for (const child of flattenedChildren.reverse()) {
|
||||
if (!nonContentTokens.has(child.type)) {
|
||||
endLine = child.endLine;
|
||||
break;
|
||||
}
|
||||
if (flattenedChildren.length > 0) {
|
||||
endLine = flattenedChildren[flattenedChildren.length - 1].endLine;
|
||||
}
|
||||
|
||||
// Look for a blank line below the list
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue