diff --git a/__tests__/migration/tables.test.ts b/__tests__/migration/tables.test.ts index 255d5ec8e..50daa6250 100644 --- a/__tests__/migration/tables.test.ts +++ b/__tests__/migration/tables.test.ts @@ -486,4 +486,21 @@ ${JSON.stringify( " `); }); + + it('compiles tables with leading escapes', () => { + const md = ` +| Col 1 | Col 2 | +| --------- | ----- | +| \\_foo_\\ | bar | +`; + + const mdx = migrate(md); + + expect(mdx).toMatchInlineSnapshot(` + "| Col 1 | Col 2 | + | --------- | ----- | + | \\_foo\\_\\ | bar | + " + `); + }); }); diff --git a/processor/migration/index.ts b/processor/migration/index.ts index 02c9907ae..45805ca56 100644 --- a/processor/migration/index.ts +++ b/processor/migration/index.ts @@ -3,12 +3,6 @@ import imagesTransformer from './images'; import linkReferenceTransformer from './linkReference'; import tableCellTransformer from './table-cell'; -const transformers = [ - emphasisTransformer, - imagesTransformer, - linkReferenceTransformer, - tableCellTransformer, -]; - -export default transformers +const transformers = [emphasisTransformer, imagesTransformer, linkReferenceTransformer, tableCellTransformer]; +export default transformers; diff --git a/processor/transform/tables-to-jsx.ts b/processor/transform/tables-to-jsx.ts index 7d401137e..dc423d274 100644 --- a/processor/transform/tables-to-jsx.ts +++ b/processor/transform/tables-to-jsx.ts @@ -36,7 +36,7 @@ const visitor = (table: Table, index: number, parent: Parents) => { parent.children.splice(index, 1, { type: 'text', value: '\n' }); }); - if (!phrasing(content)) { + if (!phrasing(content) && content.type !== 'escape') { hasFlowContent = true; return EXIT; }