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:
David Anson 2024-12-16 20:54:37 -08:00
parent 599b687849
commit 8ad4698536
5 changed files with 24 additions and 10 deletions

View file

@ -78,12 +78,11 @@ function addRangeToSet(set, start, end) {
* Filter a list of Micromark tokens by predicate.
*
* @param {Token[]} tokens Micromark tokens.
* @param {AllowedPredicate} [allowed] Allowed token predicate.
* @param {AllowedPredicate} allowed Allowed token predicate.
* @param {TransformPredicate} [transformChildren] Transform predicate.
* @returns {Token[]} Filtered tokens.
*/
function filterByPredicate(tokens, allowed, transformChildren) {
allowed = allowed || (() => true);
const result = [];
const queue = [
{
@ -278,7 +277,11 @@ const nonContentTokens = new Set([
"lineEnding",
"lineEndingBlank",
"linePrefix",
"listItemIndent"
"listItemIndent",
"undefinedReference",
"undefinedReferenceCollapsed",
"undefinedReferenceFull",
"undefinedReferenceShortcut"
]);
module.exports = {