mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Cache all top-level calls to filterByTypes (~7% runtime reduction).
This commit is contained in:
parent
85e704f32a
commit
dfcb4529f3
47 changed files with 427 additions and 481 deletions
|
|
@ -3,8 +3,8 @@
|
|||
"use strict";
|
||||
|
||||
const { addError, nextLinesRe } = require("../helpers");
|
||||
const { filterByTypes, getHtmlTagInfo } =
|
||||
require("../helpers/micromark.cjs");
|
||||
const { getHtmlTagInfo } = require("../helpers/micromark.cjs");
|
||||
const { filterByTypesCached } = require("./cache");
|
||||
|
||||
// eslint-disable-next-line jsdoc/valid-types
|
||||
/** @type import("./markdownlint").Rule */
|
||||
|
|
@ -17,7 +17,7 @@ module.exports = {
|
|||
let allowedElements = params.config.allowed_elements;
|
||||
allowedElements = Array.isArray(allowedElements) ? allowedElements : [];
|
||||
allowedElements = allowedElements.map((element) => element.toLowerCase());
|
||||
for (const token of filterByTypes(params.parsers.micromark.tokens, [ "htmlText" ], true)) {
|
||||
for (const token of filterByTypesCached([ "htmlText" ], true)) {
|
||||
const htmlTagInfo = getHtmlTagInfo(token);
|
||||
if (
|
||||
htmlTagInfo &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue