@@ -523,6 +523,7 @@ export function mdxJsxToMarkdown(options) {
523
523
*/
524
524
// eslint-disable-next-line complexity
525
525
function mdxElement ( node , _ , context , safeOptions ) {
526
+ const flow = node . type === 'mdxJsxFlowElement'
526
527
const selfClosing = node . name
527
528
? ! node . children || node . children . length === 0
528
529
: false
@@ -532,7 +533,7 @@ export function mdxJsxToMarkdown(options) {
532
533
const trackerMultiLine = track ( safeOptions )
533
534
/** @type {Array<string> } */
534
535
const serializedAttributes = [ ]
535
- const prefix = currentIndent + '<' + ( node . name || '' )
536
+ const prefix = ( flow ? currentIndent : '' ) + '<' + ( node . name || '' )
536
537
const exit = context . enter ( node . type )
537
538
538
539
trackerOneLine . move ( prefix )
@@ -590,7 +591,7 @@ export function mdxJsxToMarkdown(options) {
590
591
591
592
if (
592
593
// Block:
593
- node . type === 'mdxJsxFlowElement' &&
594
+ flow &&
594
595
// Including a line ending (expressions).
595
596
( / \r ? \n | \r / . test ( attributesOnOneLine ) ||
596
597
// Current position (including `<tag`).
@@ -653,7 +654,9 @@ export function mdxJsxToMarkdown(options) {
653
654
}
654
655
655
656
if ( ! selfClosing ) {
656
- value += tracker . move ( currentIndent + '</' + ( node . name || '' ) + '>' )
657
+ value += tracker . move (
658
+ ( flow ? currentIndent : '' ) + '</' + ( node . name || '' ) + '>'
659
+ )
657
660
}
658
661
659
662
exit ( )
0 commit comments