mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 22:40:13 +01:00
Replace helpers.overlapsAnyRange with .withinAnyRange, update code/tests for resulting behavior.
This commit is contained in:
parent
cb943a8718
commit
6718944b0f
10 changed files with 70 additions and 53 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { addError, filterTokens, forEachLine, overlapsAnyRange } =
|
||||
const { addError, filterTokens, forEachLine, withinAnyRange } =
|
||||
require("../helpers");
|
||||
const { codeBlockAndSpanRanges, lineMetadata } = require("./cache");
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ module.exports = {
|
|||
const { index } = match;
|
||||
const column = index + 1;
|
||||
const length = match[0].length;
|
||||
if (!overlapsAnyRange(exclusions, lineIndex, index, length)) {
|
||||
if (!withinAnyRange(exclusions, lineIndex, index, length)) {
|
||||
addError(
|
||||
onError,
|
||||
lineIndex + 1,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { addError, forEachLine, overlapsAnyRange } = require("../helpers");
|
||||
const { addError, forEachLine, withinAnyRange } = require("../helpers");
|
||||
const { codeBlockAndSpanRanges, lineMetadata } = require("./cache");
|
||||
|
||||
const reversedLinkRe =
|
||||
|
|
@ -24,7 +24,7 @@ module.exports = {
|
|||
if (
|
||||
!linkText.endsWith("\\") &&
|
||||
!linkDestination.endsWith("\\") &&
|
||||
!overlapsAnyRange(exclusions, lineIndex, index, length)
|
||||
!withinAnyRange(exclusions, lineIndex, index, length)
|
||||
) {
|
||||
addError(
|
||||
onError,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"use strict";
|
||||
|
||||
const {
|
||||
addError, forEachLine, htmlElementRe, overlapsAnyRange, unescapeMarkdown
|
||||
addError, forEachLine, htmlElementRe, withinAnyRange, unescapeMarkdown
|
||||
} = require("../helpers");
|
||||
const { codeBlockAndSpanRanges, lineMetadata } = require("./cache");
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ module.exports = {
|
|||
!allowedElements.includes(element.toLowerCase()) &&
|
||||
!tag.endsWith("\\>") &&
|
||||
!emailAddressRe.test(content) &&
|
||||
!overlapsAnyRange(exclusions, lineIndex, match.index, match[0].length)
|
||||
!withinAnyRange(exclusions, lineIndex, match.index, match[0].length)
|
||||
) {
|
||||
const prefix = line.substring(0, match.index);
|
||||
if (!linkDestinationRe.test(prefix)) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"use strict";
|
||||
|
||||
const { addErrorDetailIf, bareUrlRe, escapeForRegExp, forEachLine,
|
||||
forEachLink, overlapsAnyRange, linkReferenceDefinitionRe } =
|
||||
forEachLink, withinAnyRange, linkReferenceDefinitionRe } =
|
||||
require("../helpers");
|
||||
const { codeBlockAndSpanRanges, htmlElementRanges, lineMetadata } =
|
||||
require("./cache");
|
||||
|
|
@ -61,7 +61,7 @@ module.exports = {
|
|||
const index = match.index + leftMatch.length;
|
||||
const length = nameMatch.length;
|
||||
if (
|
||||
!overlapsAnyRange(exclusions, lineIndex, index, length) &&
|
||||
!withinAnyRange(exclusions, lineIndex, index, length) &&
|
||||
!names.includes(nameMatch)
|
||||
) {
|
||||
addErrorDetailIf(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue