Skip to content

Commit 928551e

Browse files
feat: add closed-border markdown table rendering with CJK/emoji support
- Detect markdown tables and render with Unicode box-drawing characters - Calculate visual terminal width for CJK/emoji (2 cols) vs ASCII (1 col) - Wrap long cells across multiple lines, prefer word-boundary breaks - Allocate column widths: narrow columns (#, status, count, date) minimal, content columns kept >= 12 chars - Render tables with <Text wrap="truncate-end"> to prevent Ink from breaking box-drawing lines at cell boundary spaces - Expose renderMarkdownSegments() for per-segment wrapping control
1 parent f177429 commit 928551e

4 files changed

Lines changed: 304 additions & 39 deletions

File tree

Screenshot_2026-05-23_195028.png

103 KB
Loading

src/ui/components/MessageView/index.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react";
22
import { Box, Text } from "ink";
3-
import { renderMarkdown } from "./markdown";
3+
import { renderMarkdown, renderMarkdownSegments } from "./markdown";
44
import {
55
buildThinkingSummary,
66
buildToolSummary,
@@ -66,8 +66,19 @@ export function MessageView({ message, collapsed, width = 80 }: MessageViewProps
6666
<Box alignSelf="stretch">
6767
<Text color="#229ac3"></Text>
6868
</Box>
69-
<Box flexGrow={1} width={contentWidth}>
70-
{content ? <Text wrap="wrap">{renderMarkdown(content)}</Text> : null}
69+
<Box flexGrow={1} width={contentWidth} flexDirection="column">
70+
{content
71+
? renderMarkdownSegments(content, Math.max(20, contentWidth - 4)).map((seg, i) => {
72+
if (seg.kind === "table") {
73+
return (
74+
<Text key={i} wrap="truncate-end">
75+
{seg.body}
76+
</Text>
77+
);
78+
}
79+
return <Text key={i}>{seg.body}</Text>;
80+
})
81+
: null}
7182
</Box>
7283
</Box>
7384
);

0 commit comments

Comments
 (0)