Remove filterTokens helper (now used only by tests).

This commit is contained in:
David Anson 2024-08-18 15:34:26 -07:00
parent 2b8369ae39
commit 55729cfcf7
5 changed files with 21 additions and 61 deletions

View file

@ -2,7 +2,6 @@
"use strict";
const { filterTokens } = require("../../helpers");
const { parse, printParseErrorCode } = require("jsonc-parser");
/** @type import("../../lib/markdownlint").Rule */
@ -13,7 +12,9 @@ module.exports = {
"parser": "markdownit",
"asynchronous": true,
"function": (params, onError) => {
filterTokens(params, "fence", (fence) => {
const fences = params.parsers.markdownit.tokens.
filter((token => token.type === "fence"));
for (const fence of fences) {
if (/jsonc?/i.test(fence.info)) {
const errors = [];
parse(fence.content, errors);
@ -28,6 +29,6 @@ module.exports = {
});
}
}
});
}
}
};