Reimplement MD013/line-length using micromark tokens.

This commit is contained in:
David Anson 2024-08-13 20:57:00 -07:00
parent 4072cf7417
commit 3b581a7f6d
10 changed files with 173 additions and 185 deletions

View file

@ -231,6 +231,20 @@ function micromarkParse(
);
}
/**
* Adds a range of numbers to a set.
*
* @param {Set<number>} set Set of numbers.
* @param {number} start Starting number.
* @param {number} end Ending number.
* @returns {void}
*/
function addRangeToSet(set, start, end) {
for (let i = start; i <= end; i++) {
set.add(i);
}
}
/**
* @callback AllowedPredicate
* @param {Token} token Micromark token.
@ -485,6 +499,7 @@ const nonContentTokens = new Set([
module.exports = {
"parse": micromarkParse,
addRangeToSet,
filterByPredicate,
filterByTypes,
getDescendantsByType,