Update MD053/link-image-reference-definitions to handle multi-line references inside blockquotes (fixes #544).

This commit is contained in:
David Anson 2022-08-01 18:48:01 -07:00
parent 5544ea54d7
commit 2c3e8c938b
6 changed files with 68 additions and 21 deletions

View file

@ -2,11 +2,10 @@
"use strict";
const { addErrorContext, isBlankLine } = require("../helpers");
const { addErrorContext, blockquotePrefixRe, isBlankLine } =
require("../helpers");
const { flattenedLists } = require("./cache");
const quotePrefixRe = /^[>\s]*/;
module.exports = {
"names": [ "MD032", "blanks-around-lists" ],
"description": "Lists should be surrounded by blank lines",
@ -18,7 +17,7 @@ module.exports = {
const firstIndex = list.open.map[0];
if (!isBlankLine(lines[firstIndex - 1])) {
const line = lines[firstIndex];
const quotePrefix = line.match(quotePrefixRe)[0].trimEnd();
const quotePrefix = line.match(blockquotePrefixRe)[0].trimEnd();
addErrorContext(
onError,
firstIndex + 1,
@ -33,7 +32,7 @@ module.exports = {
const lastIndex = list.lastLineIndex - 1;
if (!isBlankLine(lines[lastIndex + 1])) {
const line = lines[lastIndex];
const quotePrefix = line.match(quotePrefixRe)[0].trimEnd();
const quotePrefix = line.match(blockquotePrefixRe)[0].trimEnd();
addErrorContext(
onError,
lastIndex + 1,