Skip to content

Commit 019f25f

Browse files
committed
Change listItemIndent default from 'tab' (size) to 'one'
Closes GH-48.
1 parent 5b496da commit 019f25f

File tree

4 files changed

+53
-53
lines changed

4 files changed

+53
-53
lines changed

lib/types.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@
351351
* code is empty, or if it starts or ends in blank lines.
352352
* @property {boolean | null | undefined} [incrementListMarker=true]
353353
* Whether to increment the counter of ordered lists items (default: `true`).
354-
* @property {'mixed' | 'one' | 'tab' | null | undefined} [listItemIndent='tab']
355-
* How to indent the content of list items (default: `'tab'`).
354+
* @property {'mixed' | 'one' | 'tab' | null | undefined} [listItemIndent='one']
355+
* How to indent the content of list items (default: `'one'`).
356356
*
357357
* Either with the size of the bullet plus one space (when `'one'`), a tab
358358
* stop (`'tab'`), or depending on the item and its parent list (`'mixed'`,

lib/util/check-list-item-indent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @returns {Exclude<Options['listItemIndent'], null | undefined>}
99
*/
1010
export function checkListItemIndent(state) {
11-
const style = state.options.listItemIndent || 'tab'
11+
const style = state.options.listItemIndent || 'one'
1212

1313
if (style !== 'tab' && style !== 'one' && style !== 'mixed') {
1414
throw new Error(

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ Whether to increment the counter of ordered lists items (`boolean`, default:
386386
###### `options.listItemIndent`
387387

388388
How to indent the content of list items (`'mixed'`, `'one'`, or `'tab'`,
389-
default: `'tab'`).
389+
default: `'one'`).
390390
Either with the size of the bullet plus one space (when `'one'`), a tab stop
391391
(`'tab'`), or depending on the item and its parent list (`'mixed'`, uses `'one'`
392392
if the item and list are tight and `'tab'` otherwise).

test/index.js

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ test('core', async function (t) {
158158
{type: 'paragraph', children: [{type: 'text', value: 'b'}]}
159159
]
160160
}),
161-
'* a\n\n b\n'
161+
'* a\n\n b\n'
162162
)
163163
}
164164
)
@@ -175,7 +175,7 @@ test('core', async function (t) {
175175
{type: 'definition', identifier: 'b', label: 'c', url: 'd'}
176176
]
177177
}),
178-
'* a\n\n [c]: d\n'
178+
'* a\n\n [c]: d\n'
179179
)
180180
}
181181
)
@@ -192,7 +192,7 @@ test('core', async function (t) {
192192
{type: 'heading', depth: 1, children: [{type: 'text', value: 'b'}]}
193193
]
194194
}),
195-
'* a\n # b\n'
195+
'* a\n # b\n'
196196
)
197197
}
198198
)
@@ -216,7 +216,7 @@ test('core', async function (t) {
216216
},
217217
{setext: true}
218218
),
219-
'* a\n\n b\n =\n'
219+
'* a\n\n b\n =\n'
220220
)
221221
}
222222
)
@@ -696,7 +696,7 @@ test('blockquote', async function (t) {
696696
}
697697
]
698698
}),
699-
'> a\n> b\n>\n> - c\n> d\n>\n> - ***\n>\n> - e\n> f\n'
699+
'> a\n> b\n>\n> - c\n> d\n>\n> - ***\n>\n> - e\n> f\n'
700700
)
701701
})
702702

@@ -2735,7 +2735,7 @@ test('list', async function (t) {
27352735
}
27362736
]
27372737
}),
2738-
'- a\n\n- ***\n\n- b\n'
2738+
'- a\n\n- ***\n\n- b\n'
27392739
)
27402740
})
27412741

@@ -2759,7 +2759,7 @@ test('list', async function (t) {
27592759
}
27602760
]
27612761
}),
2762-
'- a\n- ***\n'
2762+
'- a\n- ***\n'
27632763
)
27642764
}
27652765
)
@@ -2785,7 +2785,7 @@ test('list', async function (t) {
27852785
}
27862786
]
27872787
}),
2788-
'- a\n\n b\n- ***\n'
2788+
'- a\n\n b\n- ***\n'
27892789
)
27902790
}
27912791
)
@@ -2828,7 +2828,7 @@ test('list', async function (t) {
28282828
}
28292829
]
28302830
}),
2831-
'1. a\n\n2. ***\n\n3. b\n'
2831+
'1. a\n\n2. ***\n\n3. b\n'
28322832
)
28332833
})
28342834

@@ -2859,7 +2859,7 @@ test('list', async function (t) {
28592859
}
28602860
]
28612861
}),
2862-
'1. a\n2. ***\n3. b\n'
2862+
'1. a\n2. ***\n3. b\n'
28632863
)
28642864
}
28652865
)
@@ -2894,7 +2894,7 @@ test('list', async function (t) {
28942894
},
28952895
{incrementListMarker: false}
28962896
),
2897-
'1. a\n1. ***\n1. b\n'
2897+
'1. a\n1. ***\n1. b\n'
28982898
)
28992899
}
29002900
)
@@ -3212,7 +3212,7 @@ test('listItem', async function (t) {
32123212
type: 'listItem',
32133213
children: [{type: 'paragraph', children: [{type: 'text', value: 'a'}]}]
32143214
}),
3215-
'* a\n'
3215+
'* a\n'
32163216
)
32173217
})
32183218

@@ -3226,7 +3226,7 @@ test('listItem', async function (t) {
32263226
{type: 'paragraph', children: [{type: 'text', value: 'b'}]}
32273227
]
32283228
}),
3229-
'* a\n\n ***\n\n b\n'
3229+
'* a\n\n ***\n\n b\n'
32303230
)
32313231
})
32323232

@@ -3314,15 +3314,15 @@ test('listItem', async function (t) {
33143314
{type: 'thematicBreak'}
33153315
]
33163316
}),
3317-
'* a\n ***\n'
3317+
'* a\n ***\n'
33183318
)
33193319
}
33203320
)
33213321

33223322
await t.test('should support `bulletOther`', async function () {
33233323
assert.equal(
33243324
to(createList(createList(createList())), {bulletOther: '+'}),
3325-
'* * +\n'
3325+
'* * +\n'
33263326
)
33273327
})
33283328

@@ -3331,7 +3331,7 @@ test('listItem', async function (t) {
33313331
async function () {
33323332
assert.equal(
33333333
to(createList(createList(createList())), {bullet: '-'}),
3334-
'- - *\n'
3334+
'- - *\n'
33353335
)
33363336
}
33373337
)
@@ -3341,7 +3341,7 @@ test('listItem', async function (t) {
33413341
async function () {
33423342
assert.equal(
33433343
to(createList(createList(createList())), {bullet: '*'}),
3344-
'* * -\n'
3344+
'* * -\n'
33453345
)
33463346
}
33473347
)
@@ -3378,7 +3378,7 @@ test('listItem', async function (t) {
33783378
type: 'list',
33793379
children: [{type: 'listItem', children: [{type: 'thematicBreak'}]}]
33803380
}),
3381-
'- ***\n'
3381+
'- ***\n'
33823382
)
33833383
}
33843384
)
@@ -3399,22 +3399,22 @@ test('listItem', async function (t) {
33993399
{type: 'listItem', children: [{type: 'thematicBreak'}]}
34003400
]
34013401
}),
3402-
'- a\n\n- ***\n'
3402+
'- a\n\n- ***\n'
34033403
)
34043404
}
34053405
)
34063406

34073407
await t.test(
34083408
'should *not* use a different bullet for an empty list item in two lists',
34093409
async function () {
3410-
assert.equal(to(createList(createList())), '* *\n')
3410+
assert.equal(to(createList(createList())), '* *\n')
34113411
}
34123412
)
34133413

34143414
await t.test(
34153415
'should use a different bullet for an empty list item in three lists (1)',
34163416
async function () {
3417-
assert.equal(to(createList(createList(createList()))), '* * -\n')
3417+
assert.equal(to(createList(createList(createList()))), '* * -\n')
34183418
}
34193419
)
34203420

@@ -3429,7 +3429,7 @@ test('listItem', async function (t) {
34293429
{type: 'listItem', children: [createList(createList())]}
34303430
]
34313431
}),
3432-
'*\n\n* * -\n'
3432+
'*\n\n* * -\n'
34333433
)
34343434
}
34353435
)
@@ -3439,7 +3439,7 @@ test('listItem', async function (t) {
34393439
async function () {
34403440
assert.equal(
34413441
to(createList(createList(createList())), {bullet: '+'}),
3442-
'+ + +\n'
3442+
'+ + +\n'
34433443
)
34443444
}
34453445
)
@@ -3449,7 +3449,7 @@ test('listItem', async function (t) {
34493449
async function () {
34503450
assert.equal(
34513451
to(createList(createList(createList(createList())))),
3452-
'* * * -\n'
3452+
'* * * -\n'
34533453
)
34543454
}
34553455
)
@@ -3459,7 +3459,7 @@ test('listItem', async function (t) {
34593459
async function () {
34603460
assert.equal(
34613461
to(createList(createList(createList(createList(createList()))))),
3462-
'* * * * -\n'
3462+
'* * * * -\n'
34633463
)
34643464
}
34653465
)
@@ -3479,7 +3479,7 @@ test('listItem', async function (t) {
34793479
])
34803480
)
34813481
),
3482-
'* * * a\n\n <!---->\n\n *\n'
3482+
'* * * a\n\n <!---->\n\n *\n'
34833483
)
34843484
}
34853485
)
@@ -3810,7 +3810,7 @@ test('escape', async function (t) {
38103810
{type: 'paragraph', children: [{type: 'text', value: '> a\n> b'}]}
38113811
]
38123812
}),
3813-
'* \\> a\n \\> b\n'
3813+
'* \\> a\n \\> b\n'
38143814
)
38153815
}
38163816
)
@@ -4296,7 +4296,7 @@ test('escape', async function (t) {
42964296
]
42974297
}
42984298
),
4299-
'1. foo\n * bar\n'
4299+
'1. foo\n * bar\n'
43004300
)
43014301
}
43024302
)
@@ -4371,9 +4371,9 @@ test('roundtrip', async function (t) {
43714371
'should roundtrip spread items in block quotes',
43724372
async function () {
43734373
const doc = [
4374-
'> * Lorem ipsum dolor sit amet',
4374+
'> * Lorem ipsum dolor sit amet',
43754375
'>',
4376-
'> * consectetur adipisicing elit',
4376+
'> * consectetur adipisicing elit',
43774377
''
43784378
].join('\n')
43794379

@@ -4385,11 +4385,11 @@ test('roundtrip', async function (t) {
43854385
'should roundtrip spread items in sublists (1)',
43864386
async function () {
43874387
const doc = [
4388-
'* Lorem ipsum dolor sit amet',
4388+
'* Lorem ipsum dolor sit amet',
43894389
'',
4390-
' 1. consectetur adipisicing elit',
4390+
' 1. consectetur adipisicing elit',
43914391
'',
4392-
' 2. sed do eiusmod tempor incididunt',
4392+
' 2. sed do eiusmod tempor incididunt',
43934393
''
43944394
].join('\n')
43954395

@@ -4401,9 +4401,9 @@ test('roundtrip', async function (t) {
44014401
'should roundtrip spread items in sublists (2)',
44024402
async function () {
44034403
const doc = [
4404-
'* 1. Lorem ipsum dolor sit amet',
4404+
'* 1. Lorem ipsum dolor sit amet',
44054405
'',
4406-
' 2. consectetur adipisicing elit',
4406+
' 2. consectetur adipisicing elit',
44074407
''
44084408
].join('\n')
44094409

@@ -4415,15 +4415,15 @@ test('roundtrip', async function (t) {
44154415
'should roundtrip spread items in sublists (3)',
44164416
async function () {
44174417
const doc = [
4418-
'* hello',
4419-
' * world',
4420-
' how',
4418+
'* hello',
4419+
' * world',
4420+
' how',
44214421
'',
4422-
' are',
4423-
' you',
4422+
' are',
4423+
' you',
44244424
'',
4425-
' * today',
4426-
'* hi',
4425+
' * today',
4426+
'* hi',
44274427
''
44284428
].join('\n')
44294429

@@ -4460,25 +4460,25 @@ test('roundtrip', async function (t) {
44604460

44614461
await t.test('should roundtrip empty lists', async function () {
44624462
const doc = [
4463-
'* foo',
4463+
'* foo',
44644464
'',
44654465
'*',
44664466
'',
4467-
'* bar',
4467+
'* bar',
44684468
'',
4469-
'* baz',
4469+
'* baz',
44704470
'',
44714471
'*',
44724472
'',
4473-
'* qux quux',
4473+
'* qux quux',
44744474
''
44754475
].join('\n')
44764476

44774477
assert.equal(to(from(doc)), doc)
44784478
})
44794479

44804480
await t.test('should roundtrip empty lists', async function () {
4481-
const doc = '* a\n\n<!---->\n\n* b\n'
4481+
const doc = '* a\n\n<!---->\n\n* b\n'
44824482

44834483
assert.equal(to(from(doc)), doc)
44844484
})
@@ -4553,7 +4553,7 @@ test('roundtrip', async function (t) {
45534553
await t.test(
45544554
'should roundtrip an empty list item in two more lists',
45554555
async function () {
4556-
const doc = '* * -\n'
4556+
const doc = '* * -\n'
45574557

45584558
assert.equal(to(from(doc)), doc)
45594559
}
@@ -4562,7 +4562,7 @@ test('roundtrip', async function (t) {
45624562
await t.test(
45634563
'should roundtrip a thematic break at the start of a list item',
45644564
async function () {
4565-
const doc = '- ***\n'
4565+
const doc = '- ***\n'
45664566

45674567
assert.equal(to(from(doc)), doc)
45684568
}

0 commit comments

Comments
 (0)