Fix MD032 to recognize blank lines around lists in block quotes.

This commit is contained in:
David Anson 2016-11-03 22:16:03 -07:00
parent f24dc4bee0
commit 0f64bd5b4e
2 changed files with 30 additions and 2 deletions

View file

@ -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;

View file

@ -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