mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Update MD034/no-bare-urls to allow quoting bare URLs.
This commit is contained in:
parent
e319f9501c
commit
320acfd7cc
4 changed files with 28 additions and 5 deletions
10
lib/md034.js
10
lib/md034.js
|
@ -24,10 +24,14 @@ module.exports = {
|
|||
const matchIndex = match.index;
|
||||
const bareUrlLength = bareUrl.length;
|
||||
// Allow "[https://example.com]" to avoid conflicts with
|
||||
// MD011/no-reversed-links
|
||||
// MD011/no-reversed-links; allow quoting as another way
|
||||
// of deliberately including a bare URL
|
||||
const leftChar = content[matchIndex - 1];
|
||||
const rightChar = content[matchIndex + bareUrlLength];
|
||||
if (
|
||||
(content[matchIndex - 1] !== "[") ||
|
||||
(content[matchIndex + bareUrlLength] !== "]")
|
||||
!((leftChar === "[") && (rightChar === "]")) &&
|
||||
!((leftChar === "\"") && (rightChar === "\"")) &&
|
||||
!((leftChar === "'") && (rightChar === "'"))
|
||||
) {
|
||||
const index = line.indexOf(content);
|
||||
const range = (index === -1) ? null : [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue