Fix Markdown table cell separator escaping in MarkdownDisplay.tsx

This commit is contained in:
Eugene (mj4444) 2026-03-18 14:59:03 +05:00 committed by GitHub
parent 4c0e4a9611
commit 0853cef7c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -111,7 +111,7 @@ const MarkdownDisplayInternal: React.FC<MarkdownDisplayProps> = ({
lines[index + 1].match(tableSeparatorRegex)
) {
inTable = true;
tableHeaders = tableRowMatch[1].split('|').map((cell) => cell.trim());
tableHeaders = tableRowMatch[1].split(/(?<!\\)\|/).map((cell) => cell.trim().replaceAll('\\|', '|'));
tableRows = [];
} else {
// Not a table, treat as regular text
@ -127,7 +127,7 @@ const MarkdownDisplayInternal: React.FC<MarkdownDisplayProps> = ({
// Skip separator line - already handled
} else if (inTable && tableRowMatch) {
// Add table row
const cells = tableRowMatch[1].split('|').map((cell) => cell.trim());
const cells = tableRowMatch[1].split(/(?<!\\)\|/).map((cell) => cell.trim().replaceAll('\\|', '|'));
// Ensure row has same column count as headers
while (cells.length < tableHeaders.length) {
cells.push('');