diff --git a/lib/markdownlint.mjs b/lib/markdownlint.mjs index 7930cb83..26a855ff 100644 --- a/lib/markdownlint.mjs +++ b/lib/markdownlint.mjs @@ -490,12 +490,14 @@ function lintContent( const needMarkdownItTokens = enabledRuleList.some( (rule) => (rule.parser === "markdownit") || (rule.parser === undefined) ); + const needMicromarkTokens = enabledRuleList.some( + (rule) => (rule.parser === "micromark") + ); const customRulesPresent = (ruleList.length !== rules.length); // Parse content into parser tokens - const micromarkTokens = micromarkParse( - content, - { "freezeTokens": customRulesPresent } - ); + const micromarkTokens = needMicromarkTokens ? + micromarkParse(content, { "freezeTokens": customRulesPresent }) : + []; // Hide the content of HTML comments from rules const preClearedContent = content; content = helpers.clearHtmlCommentText(content);