Skip to content

Commit ff331c2

Browse files
committed
Fix lists
1 parent b788eee commit ff331c2

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

lib/util/container-flow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function flow(parent, context) {
2222
if (next) {
2323
if (
2424
child.type === 'list' &&
25-
(formatCodeAsIndented(next, context) ||
25+
((next.type === 'code' && formatCodeAsIndented(next, context)) ||
2626
(child.type === next.type &&
2727
Boolean(child.ordered) === Boolean(next.ordered)))
2828
) {

test.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2490,5 +2490,37 @@ test('roundtrip', function (t) {
24902490

24912491
t.equal(to(from(doc)), doc, 'should roundtrip potential prototype injections')
24922492

2493+
doc = [
2494+
'* foo',
2495+
'*',
2496+
'* bar',
2497+
'',
2498+
'* baz',
2499+
'*',
2500+
'* qux quux',
2501+
''
2502+
].join('\n')
2503+
2504+
doc = [
2505+
'* foo',
2506+
'',
2507+
'*',
2508+
'',
2509+
'* bar',
2510+
'',
2511+
'* baz',
2512+
'',
2513+
'*',
2514+
'',
2515+
'* qux quux',
2516+
''
2517+
].join('\n')
2518+
2519+
t.equal(to(from(doc)), doc, 'should roundtrip empty lists')
2520+
2521+
doc = '* a\n\n<!---->\n\n* b\n'
2522+
2523+
t.equal(to(from(doc)), doc, 'should roundtrip lists with break comments')
2524+
24932525
t.end()
24942526
})

0 commit comments

Comments
 (0)