diff --git a/__tests__/migration/tables.test.ts b/__tests__/migration/tables.test.ts index 084ad487f..d32ca169a 100644 --- a/__tests__/migration/tables.test.ts +++ b/__tests__/migration/tables.test.ts @@ -334,4 +334,128 @@ ${JSON.stringify( " `); }); + + it('compiles tables with emphasis without converting them to lists', () => { + const md = ` +[block:parameters] +{ + "data": { + "h-0": "**Shortcut Name**", + "h-1": "**WindowsOS**", + "h-2": "_Apple - macOS_", + "0-0": "*Cut selection*", + "0-1": "__also__\\n\\n_no!_\\n\\n__no no no__", + "0-2": "!BAD" + }, + "cols": 3, + "rows": 1, + "align": [ + "left", + "left", + "left" + ] +} +[/block] + `; + + const mdx = rmdx.mdx(rmdx.mdastV6(md)); + + expect(mdx).toMatchInlineSnapshot(` + " + + + + + + + + + + + + + + + + + + + +
+ **Shortcut Name** + + **WindowsOS** + + *Apple - macOS* +
+ *Cut selection* + + **also** + + *no!* + + **no no no** + + !BAD +
+ " + `); + }); + + it('compiles more examples of emphasis', () => { + const md = ` + [block:parameters] +{ + "data": { + "h-0": "Action", + "h-1": "Description", + "0-0": "Details", + "0-1": "View additional details such as: \\n_Type_ \\n_Owner_ \\n_Created On_ \\n_Last Modified_ \\n_Last Run_" + }, + "cols": 2, + "rows": 1, + "align": [ + "left", + "left" + ] +} +[/block] + `; + + const mdx = rmdx.mdx(rmdx.mdastV6(md)); + + expect(mdx).toMatchInlineSnapshot(` + " + + + + + + + + + + + + + + + +
+ Action + + Description +
+ Details + + View additional details such as:\\ + *Type*\\ + *Owner*\\ + *Created On*\\ + *Last Modified*\\ + *Last Run* +
+ " + `); + }); }); diff --git a/processor/migration/table-cell.ts b/processor/migration/table-cell.ts index 162d6c07b..70d47081d 100644 --- a/processor/migration/table-cell.ts +++ b/processor/migration/table-cell.ts @@ -27,7 +27,7 @@ const magicIndex = (i: number, j: number) => `${i === 0 ? 'h' : `${i - 1}`}-${j} // // The following regex attempts to detect this pattern, and we'll convert it to // something more standard. -const psuedoListRegex = /^(?!([*_]+).*\1$)(?[ \t]*)\\?([*_])\s*(?.*)$/gm; +const psuedoListRegex = /^(?![ \t]*([*_]+).*\1[ \t]*$)(?[ \t]*)\\?([*_])\s*(?.*)$/gm; const migrateTableCells = (vfile: VFile) => (table: Table) => { let json;