Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions __tests__/migration/tables.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
"
`);
});
});
10 changes: 2 additions & 8 deletions processor/migration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion processor/transform/tables-to-jsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading