@@ -523,6 +523,7 @@ export function mdxJsxToMarkdown(options) {
523523 */
524524 // eslint-disable-next-line complexity
525525 function mdxElement ( node , _ , context , safeOptions ) {
526+ const flow = node . type === 'mdxJsxFlowElement'
526527 const selfClosing = node . name
527528 ? ! node . children || node . children . length === 0
528529 : false
@@ -532,7 +533,7 @@ export function mdxJsxToMarkdown(options) {
532533 const trackerMultiLine = track ( safeOptions )
533534 /** @type {Array<string> } */
534535 const serializedAttributes = [ ]
535- const prefix = currentIndent + '<' + ( node . name || '' )
536+ const prefix = ( flow ? currentIndent : '' ) + '<' + ( node . name || '' )
536537 const exit = context . enter ( node . type )
537538
538539 trackerOneLine . move ( prefix )
@@ -590,7 +591,7 @@ export function mdxJsxToMarkdown(options) {
590591
591592 if (
592593 // Block:
593- node . type === 'mdxJsxFlowElement' &&
594+ flow &&
594595 // Including a line ending (expressions).
595596 ( / \r ? \n | \r / . test ( attributesOnOneLine ) ||
596597 // Current position (including `<tag`).
@@ -653,7 +654,9 @@ export function mdxJsxToMarkdown(options) {
653654 }
654655
655656 if ( ! selfClosing ) {
656- value += tracker . move ( currentIndent + '</' + ( node . name || '' ) + '>' )
657+ value += tracker . move (
658+ ( flow ? currentIndent : '' ) + '</' + ( node . name || '' ) + '>'
659+ )
657660 }
658661
659662 exit ( )
0 commit comments