mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-18 06:50:12 +01:00
Add MD052/reference-links-images and MD053/link-image-reference-definitions for reporting issues with link and image references (fixes #144, fixes #390, fixes #425, fixes #456).
This commit is contained in:
parent
2c947abf7b
commit
c5ca661b96
21 changed files with 1333 additions and 65 deletions
|
|
@ -3,13 +3,12 @@
|
|||
"use strict";
|
||||
|
||||
const { addErrorDetailIf, filterTokens, forEachHeading, forEachLine,
|
||||
includesSorted } = require("../helpers");
|
||||
includesSorted, linkReferenceDefinitionRe } = require("../helpers");
|
||||
const { lineMetadata } = require("./cache");
|
||||
|
||||
const longLineRePrefix = "^.{";
|
||||
const longLineRePostfixRelaxed = "}.*\\s.*$";
|
||||
const longLineRePostfixStrict = "}.+$";
|
||||
const labelRe = /^\s*\[.*[^\\]]:/;
|
||||
const linkOrImageOnlyLineRe = /^[es]*(lT?L|I)[ES]*$/;
|
||||
const sternModeRe = /^([#>\s]*\s)?\S*$/;
|
||||
const tokenTypeMap = {
|
||||
|
|
@ -83,7 +82,7 @@ module.exports = {
|
|||
(strict ||
|
||||
(!(stern && sternModeRe.test(line)) &&
|
||||
!includesSorted(linkOnlyLineNumbers, lineNumber) &&
|
||||
!labelRe.test(line))) &&
|
||||
!linkReferenceDefinitionRe.test(line))) &&
|
||||
lengthRe.test(line)) {
|
||||
addErrorDetailIf(
|
||||
onError,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue