mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Avoid invoking Micromark parser when no Micromark-based rules are in effect.
This commit is contained in:
parent
00fef38119
commit
759c31760e
1 changed files with 6 additions and 4 deletions
|
@ -461,12 +461,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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue