diff --git a/__tests__/compilers/compatability.test.tsx b/__tests__/compilers/compatability.test.tsx index 382a32245..8c0d6061b 100644 --- a/__tests__/compilers/compatability.test.tsx +++ b/__tests__/compilers/compatability.test.tsx @@ -392,19 +392,16 @@ ${JSON.stringify( Term - Definition - Events - Pseudo-list:\\ ● One\\ @@ -462,19 +459,16 @@ ${JSON.stringify( Field - Description - orderby - \`\`\` { diff --git a/__tests__/compilers/tables.test.js b/__tests__/compilers/tables.test.js index faa3e0a2b..1961b725f 100644 --- a/__tests__/compilers/tables.test.js +++ b/__tests__/compilers/tables.test.js @@ -66,21 +66,18 @@ describe('table compiler', () => { th 1 🦉 - th 2 🦉 - cell 1 🦉 - cell 2 🦉 @@ -112,21 +109,18 @@ describe('table compiler', () => { th 1 🦉 - th 2 🦉 - cell 1 🦉 - cell 2 🦉 @@ -159,21 +153,18 @@ describe('table compiler', () => { th 1 🦉 - th 2 🦉 - cell 1 🦉 - cell 2 🦉 @@ -213,19 +204,16 @@ describe('table compiler', () => { * 2 * 3 - th 2 - cell 1 - cell 2 @@ -312,19 +300,16 @@ describe('table compiler', () => { * list - th 2 - cell 1 - cell 2 @@ -384,19 +369,16 @@ describe('table compiler', () => { force jsx - - \`foo | bar\` - diff --git a/__tests__/migration/link-reference.test.ts b/__tests__/migration/link-reference.test.ts index 6679e2478..fbe21fb38 100644 --- a/__tests__/migration/link-reference.test.ts +++ b/__tests__/migration/link-reference.test.ts @@ -76,19 +76,16 @@ hello there [something] Response - - \\{'Message': 'There are validation errors', 'Errors': ['ConsumerDetails: The ExternalId or CustomerID must have a value.']} - diff --git a/__tests__/migration/tables.test.ts b/__tests__/migration/tables.test.ts index 5e28cf3df..d91fdb90c 100644 --- a/__tests__/migration/tables.test.ts +++ b/__tests__/migration/tables.test.ts @@ -45,19 +45,16 @@ ${JSON.stringify( Field - Description - orderby - \`\`\` { @@ -104,30 +101,25 @@ ${JSON.stringify( Field - Description - numbered lists - 1. numbered lists 2. are supported too - loose lists - * loose lists @@ -173,19 +165,16 @@ ${JSON.stringify( Field - Description - reproduction - Oh no @@ -194,12 +183,10 @@ ${JSON.stringify( * Im so sorry - reproduction 2 - Oh no @@ -208,12 +195,10 @@ ${JSON.stringify( * Im so sorry - reproduction 3 - Oh no @@ -245,7 +230,6 @@ ${JSON.stringify( - @@ -289,29 +273,24 @@ ${JSON.stringify( **Shortcut Name** - **WindowsOS** - **Select None** - \`ESC\` - **Select All** - \`CTRL\` + \`A\` @@ -351,19 +330,16 @@ ${JSON.stringify( Field - Description - reproduction - Oh no @@ -410,23 +386,19 @@ ${JSON.stringify( **Shortcut Name** - **WindowsOS** - *Apple - macOS* - *Cut selection* - **also** @@ -434,7 +406,6 @@ ${JSON.stringify( **no no no** - !BAD @@ -474,19 +445,16 @@ ${JSON.stringify( Action - Description - Details - View additional details such as:\\ *Type*\\ diff --git a/lib/mdx.ts b/lib/mdx.ts index f63a6866e..4c0009e25 100644 --- a/lib/mdx.ts +++ b/lib/mdx.ts @@ -38,7 +38,17 @@ export const mdx = ( // @ts-expect-error - @todo: coerce the processor and tree to the correct // type depending on the value of hast - return processor.stringify(processor.runSync(tree, file)); + const string = processor.stringify(processor.runSync(tree, file)); + + // @note: mdast-util-mdx-jsx's containerFlow function inserts `\n\n` between + // all children of flow JSX elements. For table elements this introduces blank + // lines between siblings (e.g. \n\n, \n\n) which the + // MDX renderer treats as new AST nodes, breaking table structure. Collapse + // these to single newlines while preserving blank lines inside cell content. + return string.replace( + /(<\/(?:th|td|tr|thead|tbody)>)\n\n(\s*<(?:th|td|tr|thead|tbody)[\s>])/g, + '$1\n$2', + ); }; export default mdx;