mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Fix MD032 to recognize blank lines around lists in block quotes.
This commit is contained in:
parent
f24dc4bee0
commit
0f64bd5b4e
2 changed files with 30 additions and 2 deletions
|
@ -766,15 +766,16 @@ module.exports = [
|
|||
"aliases": [ "blanks-around-lists" ],
|
||||
"regexp": null,
|
||||
"func": function MD032(params, errors) {
|
||||
var blankOrListRe = /^[\s>]*($|\s)/;
|
||||
var inList = false;
|
||||
var prevLine = "";
|
||||
forEachLine(params, function forLine(line, lineIndex, inCode, onFence) {
|
||||
if (!inCode || onFence) {
|
||||
var lineTrim = line.trim();
|
||||
var listMarker = listItemMarkerRe.test(lineTrim);
|
||||
if (listMarker && !inList && !/^($|\s)/.test(prevLine)) {
|
||||
if (listMarker && !inList && !blankOrListRe.test(prevLine)) {
|
||||
errors.addContext(lineIndex + 1, lineTrim);
|
||||
} else if (!listMarker && inList && !/^($|\s)/.test(line)) {
|
||||
} else if (!listMarker && inList && !blankOrListRe.test(line)) {
|
||||
errors.addContext(lineIndex, lineTrim);
|
||||
}
|
||||
inList = listMarker;
|
||||
|
|
|
@ -62,3 +62,30 @@ Text
|
|||
> * Item
|
||||
>>* Item
|
||||
>> * Item
|
||||
|
||||
Text
|
||||
|
||||
> Quoted text
|
||||
>
|
||||
> * A list
|
||||
> * of items
|
||||
>
|
||||
> More quoted text
|
||||
|
||||
Text
|
||||
|
||||
> Quoted text
|
||||
>
|
||||
> > * A list
|
||||
> > * of items
|
||||
>
|
||||
> More quoted text
|
||||
|
||||
Text
|
||||
|
||||
> Quoted text
|
||||
>
|
||||
> > * A list
|
||||
> > * of items
|
||||
> >
|
||||
> > More quoted text
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue