Skip to content

Commit a793033

Browse files
committed
Fix indent of JSX in block quotes in JSX
1 parent 63b7767 commit a793033

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ function inferDepth(state) {
775775
while (--index > -1) {
776776
const name = state.stack[index]
777777

778-
if (name === 'listItem') break
778+
if (name === 'blockquote' || name === 'listItem') break
779779
if (name === 'mdxJsxFlowElement') depth++
780780
}
781781

test.js

+38-1
Original file line numberDiff line numberDiff line change
@@ -2550,7 +2550,7 @@ test('roundtrip', async function (t) {
25502550
}
25512551
)
25522552

2553-
await t.test('should roundtrip `nested JSXs and lists`', async function () {
2553+
await t.test('should roundtrip `nested JSX and lists`', async function () {
25542554
const source = `<x>
25552555
* Alpha
25562556
@@ -2583,6 +2583,43 @@ test('roundtrip', async function (t) {
25832583
`
25842584
equal(source, source)
25852585
})
2586+
2587+
await t.test(
2588+
'should roundtrip `nested JSX and block quotes`',
2589+
async function () {
2590+
const source = `<x>
2591+
> Alpha
2592+
>
2593+
> <y>
2594+
> > Bravo
2595+
> >
2596+
> > <z>
2597+
> > <a>
2598+
> > > Charlie
2599+
> > >
2600+
> > > > Delta
2601+
> > > >
2602+
> > > > <b>
2603+
> > > > Echo
2604+
> > > > </b>
2605+
> > >
2606+
> > > <b>
2607+
> > > Foxtrot
2608+
> > > </b>
2609+
> > </a>
2610+
> > </z>
2611+
> </y>
2612+
2613+
<y>
2614+
<z>
2615+
Golf
2616+
</z>
2617+
</y>
2618+
</x>
2619+
`
2620+
equal(source, source)
2621+
}
2622+
)
25862623
})
25872624

25882625
/**

0 commit comments

Comments
 (0)