mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-18 06:50:12 +01:00
Omit micromark parsing if there is no related rules
This commit is contained in:
parent
a4c553a45a
commit
bb82b4a95d
1 changed files with 6 additions and 4 deletions
|
|
@ -490,12 +490,14 @@ function lintContent(
|
||||||
const needMarkdownItTokens = enabledRuleList.some(
|
const needMarkdownItTokens = enabledRuleList.some(
|
||||||
(rule) => (rule.parser === "markdownit") || (rule.parser === undefined)
|
(rule) => (rule.parser === "markdownit") || (rule.parser === undefined)
|
||||||
);
|
);
|
||||||
|
const needMicromarkTokens = enabledRuleList.some(
|
||||||
|
(rule) => (rule.parser === "micromark")
|
||||||
|
);
|
||||||
const customRulesPresent = (ruleList.length !== rules.length);
|
const customRulesPresent = (ruleList.length !== rules.length);
|
||||||
// Parse content into parser tokens
|
// Parse content into parser tokens
|
||||||
const micromarkTokens = micromarkParse(
|
const micromarkTokens = needMicromarkTokens ?
|
||||||
content,
|
micromarkParse(content, { "freezeTokens": customRulesPresent }) :
|
||||||
{ "freezeTokens": customRulesPresent }
|
[];
|
||||||
);
|
|
||||||
// Hide the content of HTML comments from rules
|
// Hide the content of HTML comments from rules
|
||||||
const preClearedContent = content;
|
const preClearedContent = content;
|
||||||
content = helpers.clearHtmlCommentText(content);
|
content = helpers.clearHtmlCommentText(content);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue