diff --git a/packages/lexical-markdown/src/MarkdownExport.ts b/packages/lexical-markdown/src/MarkdownExport.ts index 55a9a6caa66..ea6d3ef700d 100644 --- a/packages/lexical-markdown/src/MarkdownExport.ts +++ b/packages/lexical-markdown/src/MarkdownExport.ts @@ -44,13 +44,9 @@ export function createMarkdownExport( // code will be exported as `**Bold Code**`, as the code format will be applied first, and the bold format // will be applied second and thus skipped entirely, as the code format will prevent any further formatting. .sort((a, b) => { - if (a.format.includes('code') && !b.format.includes('code')) { - return 1; - } else if (!a.format.includes('code') && b.format.includes('code')) { - return -1; - } else { - return 0; - } + return ( + Number(a.format.includes('code')) - Number(b.format.includes('code')) + ); }); return (node) => {