File tree Expand file tree Collapse file tree
packages/cli/src/ui/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ const MarkdownDisplayInternal: React.FC<MarkdownDisplayProps> = ({
111111 lines [ index + 1 ] . match ( tableSeparatorRegex )
112112 ) {
113113 inTable = true ;
114- tableHeaders = tableRowMatch [ 1 ] . split ( '|' ) . map ( ( cell ) => cell . trim ( ) ) ;
114+ tableHeaders = tableRowMatch [ 1 ] . split ( / (?< ! \\ ) \| / ) . map ( ( cell ) => cell . trim ( ) . replaceAll ( '\\|' , '|' ) ) ;
115115 tableRows = [ ] ;
116116 } else {
117117 // Not a table, treat as regular text
@@ -127,7 +127,7 @@ const MarkdownDisplayInternal: React.FC<MarkdownDisplayProps> = ({
127127 // Skip separator line - already handled
128128 } else if ( inTable && tableRowMatch ) {
129129 // Add table row
130- const cells = tableRowMatch [ 1 ] . split ( '|' ) . map ( ( cell ) => cell . trim ( ) ) ;
130+ const cells = tableRowMatch [ 1 ] . split ( / (?< ! \\ ) \| / ) . map ( ( cell ) => cell . trim ( ) . replaceAll ( '\\|' , '|' ) ) ;
131131 // Ensure row has same column count as headers
132132 while ( cells . length < tableHeaders . length ) {
133133 cells . push ( '' ) ;
Original file line number Diff line number Diff line change @@ -35,7 +35,8 @@ export const TableRenderer: React.FC<TableRendererProps> = ({
3535
3636 // Ensure table fits within terminal width
3737 const totalWidth = columnWidths . reduce ( ( sum , width ) => sum + width + 1 , 1 ) ;
38- const scaleFactor = totalWidth > contentWidth ? contentWidth / totalWidth : 1 ;
38+ const fixedWidth = columnWidths . length + 1 ;
39+ const scaleFactor = totalWidth > contentWidth ? ( contentWidth - fixedWidth ) / ( totalWidth - fixedWidth ) : 1 ;
3940 const adjustedWidths = columnWidths . map ( ( width ) =>
4041 Math . floor ( width * scaleFactor ) ,
4142 ) ;
You can’t perform that action at this time.
0 commit comments