mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Hide the content of inline configuration HTML comments from the linting process to avoid false positives.
This commit is contained in:
parent
535aa1a2ee
commit
bbec8c5c1e
7 changed files with 80 additions and 40 deletions
|
@ -474,23 +474,24 @@ function lintContent(
|
|||
content = content.replace(/^\uFEFF/, "");
|
||||
// Remove front matter
|
||||
const removeFrontMatterResult = removeFrontMatter(content, frontMatter);
|
||||
const frontMatterLines = removeFrontMatterResult.frontMatterLines;
|
||||
// Ignore the content of HTML comments
|
||||
content = helpers.clearHtmlCommentText(removeFrontMatterResult.content);
|
||||
const { frontMatterLines } = removeFrontMatterResult;
|
||||
content = removeFrontMatterResult.content;
|
||||
// Get enabled rules per line (with HTML comments present)
|
||||
const { effectiveConfig, enabledRulesPerLineNumber } =
|
||||
getEnabledRulesPerLineNumber(
|
||||
ruleList,
|
||||
content.split(helpers.newLineRe),
|
||||
frontMatterLines,
|
||||
noInlineConfig,
|
||||
config,
|
||||
mapAliasToRuleNames(ruleList)
|
||||
);
|
||||
// Hide the content of HTML comments from rules, etc.
|
||||
content = helpers.clearHtmlCommentText(content);
|
||||
// Parse content into tokens and lines
|
||||
const tokens = md.parse(content, {});
|
||||
const lines = content.split(helpers.newLineRe);
|
||||
annotateTokens(tokens, lines);
|
||||
const aliasToRuleNames = mapAliasToRuleNames(ruleList);
|
||||
const { effectiveConfig, enabledRulesPerLineNumber } =
|
||||
getEnabledRulesPerLineNumber(
|
||||
ruleList,
|
||||
lines,
|
||||
frontMatterLines,
|
||||
noInlineConfig,
|
||||
config,
|
||||
aliasToRuleNames
|
||||
);
|
||||
// Create parameters for rules
|
||||
const paramsBase = helpers.deepFreeze({
|
||||
name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue