Cache results of inlineCodeSpanRanges for use by MD011/MD044.

This commit is contained in:
David Anson 2021-06-17 22:01:27 -07:00
parent 706f48bd25
commit 7d40926367
6 changed files with 56 additions and 39 deletions

View file

@ -3,9 +3,8 @@
"use strict";
const { addErrorDetailIf, bareUrlRe, escapeForRegExp, forEachLine,
inlineCodeSpanRanges, overlapsAnyRange, linkRe, linkReferenceRe } =
require("../helpers");
const { lineMetadata } = require("./cache");
overlapsAnyRange, linkRe, linkReferenceRe } = require("../helpers");
const { inlineCodeSpanRanges, lineMetadata } = require("./cache");
module.exports = {
"names": [ "MD044", "proper-names" ],
@ -37,7 +36,7 @@ module.exports = {
}
});
if (!includeCodeBlocks) {
exclusions.push(...inlineCodeSpanRanges(params.lines));
exclusions.push(...inlineCodeSpanRanges());
}
for (const name of names) {
const escapedName = escapeForRegExp(name);