mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Fix issue with MD044/proper-names where stateful RegExp could fail to match bare URLs, remove unnecessary use of bareUrlRe by MD033/no-inline-html.
This commit is contained in:
parent
57c661700a
commit
31ffe52f0f
4 changed files with 51 additions and 5 deletions
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { addError, bareUrlRe, forEachLine, unescapeMarkdown } =
|
||||
require("../helpers");
|
||||
const { addError, forEachLine, unescapeMarkdown } = require("../helpers");
|
||||
const { lineMetadata } = require("./cache");
|
||||
|
||||
const htmlElementRe = /<(([A-Za-z][A-Za-z0-9-]*)(?:\s[^>]*)?)\/?>/g;
|
||||
|
|
@ -24,10 +23,10 @@ module.exports = {
|
|||
forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
|
||||
let match = null;
|
||||
// eslint-disable-next-line no-unmodified-loop-condition
|
||||
while (!inCode && (match = htmlElementRe.exec(line))) {
|
||||
while (!inCode && ((match = htmlElementRe.exec(line)) !== null)) {
|
||||
const [ tag, content, element ] = match;
|
||||
if (!allowedElements.includes(element.toLowerCase()) &&
|
||||
!tag.endsWith("\\>") && !bareUrlRe.test(content) &&
|
||||
!tag.endsWith("\\>") &&
|
||||
!emailAddressRe.test(content)) {
|
||||
const prefix = line.substring(0, match.index);
|
||||
if (!linkDestinationRe.test(prefix) && !inlineCodeRe.test(prefix)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue