Rename helpers.bareUrlRe to urlRe, improve it a little, add tests

This commit is contained in:
David Anson 2022-12-15 13:54:54 -08:00
parent 6e38259a4a
commit 2e2937081e
5 changed files with 103 additions and 16 deletions

View file

@ -2,7 +2,7 @@
"use strict";
const { addErrorContext, bareUrlRe, withinAnyRange } = require("../helpers");
const { addErrorContext, urlRe, withinAnyRange } = require("../helpers");
const { codeBlockAndSpanRanges, htmlElementRanges, referenceLinkImageData } =
require("./cache");
@ -28,7 +28,7 @@ module.exports = {
while ((match = htmlLinkRe.exec(line)) !== null) {
lineExclusions.push([ lineIndex, match.index, match[0].length ]);
}
while ((match = bareUrlRe.exec(line)) !== null) {
while ((match = urlRe.exec(line)) !== null) {
const [ bareUrl ] = match;
const matchIndex = match.index;
const bareUrlLength = bareUrl.length;