From 6f50b5e3a1b2fe577d83965f84d2ebcd14a37450 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 30 Sep 2020 12:30:55 +0200 Subject: [PATCH] Fix `spread` on lists in block quotes --- index.js | 7 +- test/fixtures/list.json | 147 +++++++++++++++++++++++++++++++++++++++- test/fixtures/list.md | 6 +- 3 files changed, 155 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 41e7834..cf449bb 100644 --- a/index.js +++ b/index.js @@ -286,7 +286,12 @@ function compiler(options) { tailEvent[1].type = types.lineEnding lineIndex = tailIndex - } else if (tailEvent[1].type === types.linePrefix) { + } else if ( + tailEvent[1].type === types.linePrefix || + tailEvent[1].type === types.blockQuotePrefix || + tailEvent[1].type === types.blockQuotePrefixWhitespace || + tailEvent[1].type === types.blockQuoteMarker + ) { // Empty } else { break diff --git a/test/fixtures/list.json b/test/fixtures/list.json index cfd744f..51b19fa 100644 --- a/test/fixtures/list.json +++ b/test/fixtures/list.json @@ -1197,6 +1197,147 @@ "offset": 163 } } + }, + { + "type": "blockquote", + "children": [ + { + "type": "list", + "ordered": false, + "start": null, + "spread": true, + "children": [ + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "w", + "position": { + "start": { + "line": 47, + "column": 5, + "offset": 169 + }, + "end": { + "line": 47, + "column": 6, + "offset": 170 + } + } + } + ], + "position": { + "start": { + "line": 47, + "column": 5, + "offset": 169 + }, + "end": { + "line": 47, + "column": 6, + "offset": 170 + } + } + } + ], + "position": { + "start": { + "line": 47, + "column": 3, + "offset": 167 + }, + "end": { + "line": 47, + "column": 6, + "offset": 170 + } + } + }, + { + "type": "listItem", + "spread": false, + "checked": null, + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "x", + "position": { + "start": { + "line": 49, + "column": 5, + "offset": 177 + }, + "end": { + "line": 49, + "column": 6, + "offset": 178 + } + } + } + ], + "position": { + "start": { + "line": 49, + "column": 5, + "offset": 177 + }, + "end": { + "line": 49, + "column": 6, + "offset": 178 + } + } + } + ], + "position": { + "start": { + "line": 49, + "column": 3, + "offset": 175 + }, + "end": { + "line": 49, + "column": 6, + "offset": 178 + } + } + } + ], + "position": { + "start": { + "line": 47, + "column": 3, + "offset": 167 + }, + "end": { + "line": 49, + "column": 6, + "offset": 178 + } + } + } + ], + "position": { + "start": { + "line": 47, + "column": 1, + "offset": 165 + }, + "end": { + "line": 49, + "column": 6, + "offset": 178 + } + } } ], "position": { @@ -1206,9 +1347,9 @@ "offset": 0 }, "end": { - "line": 45, - "column": 4, - "offset": 163 + "line": 50, + "column": 1, + "offset": 179 } } } diff --git a/test/fixtures/list.md b/test/fixtures/list.md index d387d92..7ebe5ba 100644 --- a/test/fixtures/list.md +++ b/test/fixtures/list.md @@ -42,4 +42,8 @@ - -- v \ No newline at end of file +- v + +> + w +> +> + x