From 50ccf2e898edd3fd698f69bf0d4718a6725890de Mon Sep 17 00:00:00 2001 From: Evan Jacobs Date: Tue, 7 Jan 2025 00:39:26 -0500 Subject: [PATCH] refactor: further simplify --- index.tsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/index.tsx b/index.tsx index 50e62d9..f2b1f0a 100644 --- a/index.tsx +++ b/index.tsx @@ -643,22 +643,23 @@ function parseTableRow( source .trim() // isolate situations where a pipe should be ignored (inline code, escaped, etc) - .split(/( *(?:`[^`]*`|\\\||\|) *)/) + .split(/(`[^`]*`|\\\||\|)/) .filter(Boolean) .forEach((fragment, i, arr) => { if (fragment.trim() === '|') { flush() - if (tableOutput && i !== 0 && i !== arr.length - 1) { - // Split the current row - cells.push([]) - } else if (!tableOutput) { - acc += fragment - flush() + if (tableOutput) { + if (i !== 0 && i !== arr.length - 1) { + // Split the current row + cells.push([]) + } + + return } - } else if (fragment !== '') { - acc += fragment } + + acc += fragment }) flush()